-
Notifications
You must be signed in to change notification settings - Fork 219
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
import() does not work #316
Comments
Im seeing this issue as well but when using Webpack4's Webpack version: Webpack Karma version: Karma version: Please tell us about your environment: Browser: [Chrome 57] Current behavior: Expected/desired behavior: Webpack Config: optimization: {
splitChunks: {
cacheGroups: {
vendor: {
test: /\/node_modules\//,
name: 'vendor',
chunks: 'initial',
filename: '[name].js',
},
},
},
} Custom Context File ...
<script src="context.js"></script>
<script src="debug.js"></script>
<script type="text/javascript">
// Configure our Karma
%CLIENT_CONFIG%
// All served files with the latest timestamps
%MAPPINGS%
</script>
<!-- Dynamically replaced with <script> tags -->
<script type="text/javascript" src="_karma_webpack_/vendor.js" crossorigin="anonymous"></script>
<script type="text/javascript" src="_karma_webpack_/firstparty.js" crossorigin="anonymous"></script>
%SCRIPTS%
<script type="text/javascript">
console.log('Using custom debug file test.customDebugFile.html');
window.__karma__.loaded();
</script>
... |
FWIW, it's also broken for karma-webpack 4.0.0-beta.0 + webpack 4.1.1. |
+1 - This seems to be a regression that's happened multiple times now in a world where code splitting and dynamic imports are only getting more prevalent. |
+1 seeing this in latest version with Webpack 3 |
Not sure if this is the same error, but I solved this by setting webpack's |
I'm submitting a bug report
Webpack version:
4.1.1
Webpack Karma version:
2.0.13
Karma version:
2.0.0
Please tell us about your environment:
Windows 10
Browser: [Chrome 64] (probably others as well)
Current behavior:
import()
fails with the error:Error: Loading chunk 0 failed.
Expected/desired behavior:
import()
should import a script and the exports should be available.See https://github.com/philipahlberg/karma-webpack-dynamic-import for a setup that showcases the problem.
The minimum necessary steps to reproduce is:
npm install --save-dev karma webpack karma-webpack
import()
What is the expected behavior?
import('./import.js')
should import the file './import.js' and return its exports.What is the motivation / use case for changing the behavior?
To allow testing things with dynamic imports.
The text was updated successfully, but these errors were encountered: