Skip to content
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

Partial Expressions in require call #289

Closed
alanbentley opened this issue Dec 15, 2017 · 6 comments
Closed

Partial Expressions in require call #289

alanbentley opened this issue Dec 15, 2017 · 6 comments

Comments

@alanbentley
Copy link

I'm submitting a bug report

Webpack version:
3.10.0

Webpack Karma version:
2.0.8/9

Karma version:
0.12.37

Please tell us about your environment:
OSX 10.12.6

Browser:
Phantom

Current behavior:
partial expressions in require statements were working fine in version 2.0.5-7 but are now causing 404 responses

Expected/desired behavior:
Asynchronously load module

  • If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem along with a gist/jsbin of your webpack configuration.

require(['views/' + view], function(view) {

works fine in Use karma-webpack 2.0.7 however using karma-webpack 2.0.8-2.0.9:

WARN [web-server]: 404: /var/folders/qr/vvd9_2fx45d5pfgfbb8qhbmh0000gn/T/_karma_webpack_/0.bundle.js

Changing the dependancy to a hard coded string enables the module to be found.

@alanbentley
Copy link
Author

Had a quick look and looks like the issue is in 0616dda with the new regex:

urlRegex: new RegExp('^' + os.tmpdir() + '\/_karma_webpack_\/.*/')

a quick test by changing this to the following resolves finding the module:

urlRegex: /.*\/_karma_webpack_\/.*/,

@andrexx
Copy link

andrexx commented Dec 17, 2017

Apparently broken the possibility of loading lazy load bundles. Got a similar issue on windows with angular application. As workaround pin karma-webpack version to 2.0.6

Chrome 63.0.3239 (Windows 10 0.0.0): Executed 73 of 318 SUCCESS (0 secs / 0.109 secs)
ERROR: 'Unhandled Promise rejection:', 'Loading chunk 0 failed.', '; Zone:', 'ProxyZone', '; Task:', 'Promise.then', ';
Value:', Error{__zone_symbol__currentTask: ZoneTask{_zone: Zone{_properties: ..., _parent: ..., _name: ..., _zoneDelegate: ...}, runCount: 0,
_zoneDelegates: null, _state: 'notScheduled', type: 'microTask', source: 'Promise.then',
data: undefined, scheduleFn: undefined, cancelFn: null, callback: function () { ... }, invoke: function () { ... }}}, 'Error: Loading chunk 0 failed.
    at HTMLScriptElement.onScriptComplete 
...

@rodmax
Copy link
Contributor

rodmax commented Dec 21, 2017

Hi guys could you verify fix from #293
Quick steps to setup env

git clone [email protected]:rodmax/karma-webpack.git
cd karma-webpack
git checkout fix-url-regex-for-custom-file-handler
npm i 
npm link
npm i [email protected]   # you should install peer dependency for using "npm link", you may choose your version of webpack instead 3.6.0
npm run build  # after it you should see "js" files in ./lib dir

cd path/to/you-repo
npm link karma-webpack  # mount my pull-requested version
npm run tests # run your tests

@alanbentley
Copy link
Author

Sorry for the delay - I can confirm that fix-url-regex-for-custom-file-handler fixes my issue

@andrexx
Copy link

andrexx commented Dec 27, 2017

Unfortunately I keep getting an error "Error: Loading chunk 0 failed.".
I'll try to create a minimal reproducible example.

@michael-ciniawsky
Copy link
Contributor

Fix released in v2.0.10 🎉 Please try it out. If still regressions please open a new issue :)

@michael-ciniawsky michael-ciniawsky removed this from the 2.0.10 milestone Feb 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants