Ignoring optional modules of NPM packages


#1

Hello,

I was wondering if there’s an elegant way to tell Ember-CLI to ignore a package’s optional modules? For example I’m using the NPM package xlsx which has one optional module for international support which is quite large. When Ember-CLI builds my app it’s including the dist file that includes that optional module. I’d like to specify somehow that it should only use the “core” file instead. What are my options?

The README for that package states:

“Webpack and browserify builds include optional modules by default. Webpack can be configured to remove support with resolve.alias:”

/* uncomment the lines below to remove support */
resolve: {
    alias: { "./dist/cpexcel.js": "" } // <-- omit international support
}

But I don’t know how to make use of this if at all.

As a side note I know that I could simply download the zip and stick it in my vendor/ directory and simply have it imported but that’s a “meh” solution.

Any guidance is appreciated :slight_smile: