-
-
Notifications
You must be signed in to change notification settings - Fork 381
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
Chunk issues with dynamic imports. #182
Comments
I figure the issue in somewhere in the Babel Plugin. Input: loadable.lib(() => import(`react-intl/locale-data/${language}`)) Output: loadable.lib({
chunkName: function chunkName() {
return "react-intl-locale-data/" + language;
},
isReady: function isReady(props) {
if (typeof __webpack_modules__ !== 'undefined') {
return !!__webpack_modules__[this.resolve(props)];
}
return false;
},
requireAsync: function requireAsync() {
return import(
/* webpackChunkName: "[request]" */
"react-intl/locale-data/" + language);
},
requireSync: function requireSync(props) {
var id = this.resolve(props);
if (typeof __webpack_require__ !== 'undefined') {
return __webpack_require__(id);
}
return eval('module.require')(id);
},
resolve: function resolve() {
if (require.resolveWeak) {
return require.resolveWeak("react-intl/locale-data/" + language);
}
return require('path').resolve(__dirname, "react-intl/locale-data/" + language);
}
}); I figure that a) Looking at the Webpack Stats it seems like Webpack produces chunks named by just the dynamic part of the import - in this case e.g. |
Hello @serwer-WittGruppe, you are right! I am on it! |
If you are on it. Can you verify that it re-uses existing chunk names when they contain the |
Thanks! |
If chunkName is the same it is reused. The algorithm is the same so the chunkName should be reused between aggressive and simple imports. |
🐛 Bug Report
I am trying to load
react-intl
data files usingloadable.lib()
which actually looks like a good match for this. As I have to support quite a range of locales I thought about usingloadable.lib
together with a template string:I see the following error message on the console of my SSR application:
To Reproduce
Actually use the same demo code as shown.
Expected behavior
That is works. Easy peasy ;)
Link to repl or repo (highly encouraged)
Working on it.
Issues without a reproduction link are likely to stall.
Env
The text was updated successfully, but these errors were encountered: