Skip to content

Webpack + 3rd party library: Specifying alternate file instead of package entry point #3335

Description

@MattSidor

OS

Mac OSX El Capitan

Versions

angular-cli: 1.0.0-beta.20-4
node: 6.7.0
os: darwin x64

Repro steps.

Install 'mapbox-gl' library: npm install mapbox-gl --save
Install relevant typings: npm install @types/mapbox-gl --save-dev
Attempt to import: import * as mapboxgl from 'mapbox-gl'

Forgive my naiveté – I'm new to Angular 2 and webpack – but I am trying to use a 3rd party library (mapbox-gl-js) that was designed to work with Browserify.

As a result, in order to adapt it with webpack, their installation instructions require you to use the distribution build instead of the package entry point:

import mapboxgl from 'mapbox-gl/dist/mapbox-gl.js';

Normally, to work around this, I would add a resolve.alias property in my webpack.config.js file:

resolve: {
  alias: {
    'mapbox-gl': path.resolve('./node_modules/mapbox-gl/dist/mapbox-gl.js')
  }
}

I understand I cannot override the webpack configuration settings in angular-cli, based on the discussion in issue #1656.

So, my question is: what are the current best workarounds to this problem?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions