Closed ViieeS closed 3 years ago
Running into this same error, while trying to upgrade from karma v3.1.0 to 4.1.0 and karma-webpack 3.0.0 to 4.0.2.
These are the module.rules
of the used webpack configuration:
[{
"test": /.+i18n[\/\\](.*)\.yaml/,
"use": [{
"loader": "raw-loader"
}, {
"loader": "yaml-loader"
}]
}, {
"test": /\.(gif|ico|jpg|png|svg|txt)$/,
"use": [{
"loader": "url-loader"
}]
}, {
"test": /\.html$/,
"use": [{
"loader": "html-loader",
"options": {
"attrs": ["img:src", ":ng-src"],
"minimize": true
}
}]
}, {
"test": /\.tsx?$/,
"use": [{
"loader": "ng-annotate-loader"
}, {
"loader": "ts-loader",
"options": {
"experimentalFileCaching": true,
"transpileOnly": true
}
}]
}, {
"test": /\.scss$/,
"use": [{
"loader": "null-loader"
}]
}]
Can you both post your entire webpack config? It appears its failing to clone it when it gets to a regular expression somewhere
I managed to launch Karma with a Chrome debugger, and got the place where the error is coming from and found it is this issue jonschlinkert/shallow-clone#4 and was fixed in v3.0.1 of that project.
Seems like updating shallow-clone to that version, should solve this issue.
I am experiencing the same issue. @schmkr what do you mean with shallow clone?
I meant with that this project depends on the clone-deep
package which has a dependency on shallow-clone
. That package, seems to have fixed the Invalid flags supplied to RegExp constructor
error in version 3.0.1 and if I recall correctly at the time of writing previous comment, the installed version of shallow-clone
was not yet 3.0.1
I was totally mistaken, deleted this post
I was mistaken: the Can not load "webpack"!
message simply happens any time there's any error in the plugin. In my case, the plugin tries to interact with older Webpack APIs that don't exist in the newer Webpack that I have installed, so I needed to downgrade Webpack.
At some point when I got this something removed my install of webpack. The steps I took that seemed to matter was: npm uninstall karma-webpack npm i karma-webpack@4.0.0-rc.6 --save-dev npm install webpack --save-dev
At this point it worked with version 4.0.0-rc6. I have no idea when webpack was uninstalled, but it was missing at some point.
After all that I ran: npm uninstall karma-webpack npm i karma-webpack --save-dev
This then worked with the latest version.
Can anyone on an older build let me know if this is fixed with version 5.0.0-alpha.6
? I believe it should be compatible with webpack 4.
Closing this as this does not seem to be an issue in 5.0.0, if you are still having trouble, feel free to open another issue and I'll assist as best I can!
I got this error after update from
4.0.0-rc.6
to4.0.2
.Code
karma.conf.js