Tested with
ETP:2.1.0
webpack: 2.2.1
Node v7.7.1
There seems to be some issue when importing a scss file in a common chunk if that common chunk also imports an async/dynamic js chunk which imports another scss file.
File setup
//===== a.js =====
import './common';
//===== b.js =====
import './common';
//===== common.js =====
import './common.scss';
import ('./async.js'); // async import
//===== async.js =====
import './async.scss'
This issue happens when allChunks:false [I would like to lazy load js and associated css], and what seems to be happening is that the runtime code for css-loader is not always being included in the bundle which results in the below error?
Uncaught (in promise) TypeError: Cannot read property 'call' of undefined
at __webpack_require__ (bootstrap 3d99482…:52)
at Object.95 (async.scss:1)
at __webpack_require__ (bootstrap 3d99482…:52)
at Object.96 (async.scss?eb60:4)
at __webpack_require__ (bootstrap 3d99482…:52)
at Object.94 (0.cb65e0.chunk.js:8)
at __webpack_require__ (bootstrap 3d99482…:52)
But if I for example update common.scss while webpack-dev-server is running, when the bundle gets rebuilt and the page refreshes I can see the code for css-loader in the chunk and the error goes away, but if I restart webpack-dev-server again and refresh the error comes back and css-loader code is gone.
I have created a repo with showing this error
https://github.com/ericnoguchi/webpack-testing
steps to reproduce.
- npm install
- npm run startDev
- go to http://localhost:8080/ and observe error
- updated any of the scss modules e.g. common.scss and after webpack-dev-server refreshes error is gone.
- check async/*.chunk.js contents in each case injected in the head tag.
Link stack overflow issue:
http://stackoverflow.com/questions/42687881/async-js-chunks-that-include-scss-imports-cause-uncaught-in-promise-typeerr
Tested with
ETP:2.1.0
webpack: 2.2.1
Node v7.7.1
There seems to be some issue when importing a scss file in a common chunk if that common chunk also imports an async/dynamic js chunk which imports another scss file.
File setup
This issue happens when allChunks:false [I would like to lazy load js and associated css], and what seems to be happening is that the runtime code for css-loader is not always being included in the bundle which results in the below error?
But if I for example update common.scss while webpack-dev-server is running, when the bundle gets rebuilt and the page refreshes I can see the code for css-loader in the chunk and the error goes away, but if I restart webpack-dev-server again and refresh the error comes back and css-loader code is gone.
I have created a repo with showing this error
https://github.com/ericnoguchi/webpack-testing
steps to reproduce.
Link stack overflow issue:
http://stackoverflow.com/questions/42687881/async-js-chunks-that-include-scss-imports-cause-uncaught-in-promise-typeerr