-
Notifications
You must be signed in to change notification settings - Fork 137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
externals: ["@glimmer/validator"]
does not work in apps
#1487
Comments
Another workaround is to tell webpack directly to treat it as commonjs (which means webpack itself will do the // ember-cli-build.js
compatBuild(app, Webpack, {
packagerOptions: {
webpackConfig: {
externals: {
'@glimmer/validator': 'commonjs @glimmer/validator',
},
},
},
} You're correct that the spec says this option is available to apps, however it's only available to apps that also declare We just shipped embroider 3.1 and have been noticing that this class of problem is likely to be more common in that release. The reason is that we no longer do a complete rewrite of node_modules, which leaves us more vulnerable to accidental resolutions now. Up until now, the ember-provided virtual packages have always just been a fallback when normal resolving fails, but I think we're forced to aggressively externalize all of them.
So in summary: we plan to ship a bugfix that would externalize |
Sounds like a good plan and thanks for the explanation 🙌🏼 |
This should be fixed by #1495 |
To reproduce:
ember new --embroider zomg
package.json
, add"ember-addon": { "externals": ["@glimmer/validator"] }
Note: per spec, the key should be "ember" Support
ember
key in package.json (instead ofember-addon
) #1226app.js
or anywhere else, add an import for@glimmer/validator
Expected result:
@glimmer/validator
should only be included in oncevendor.js
, not inchunks.*.js
Actual result:
@glimmer/validator
is included invendor.js
, and then a second time in one of the chunks.This is inefficient, but in the specific case of
@glimmer/validator
it actually causes an error when multiple copies are included. It seems like addons are able to use the same configuration successfully to avoid the problem, and per spec theexternals
key is one of the few configurations that are supposed to work in both apps and addons.Using
require
instead works as a workaround.The text was updated successfully, but these errors were encountered: