karma-webpack: Webpack 2.2.0-rc.4 throws an error because karma-webpack passes incorrect entry option
I’m submitting a bug report
Webpack version:
2.2.0-rc.4
Webpack Karma version:
1.8.1
Karma version:
1.3.0
Please tell us about your environment:
OSX 10.12
Current behavior:
11 01 2017 17:47:50.284:ERROR [preprocess]: Can not load "webpack"!
WebpackOptionsValidationError: Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
- configuration.entry should be one of these:
object { <key>: non-empty string | [non-empty string] } | non-empty string | [non-empty string] | function
The entry point(s) of the compilation.
Details:
* configuration.entry should NOT have less than 1 properties ({
"keyword": "minProperties",
"dataPath": ".entry",
"schemaPath": "#/oneOf/0/minProperties",
"params": {
"limit": 1
},
"message": "should NOT have less than 1 properties",
"schema": 1,
"parentSchema": {
"minProperties": 1,
"additionalProperties": {
"oneOf": [
{
"description": "The string is resolved to a module which is loaded upon startup.",
"minLength": 1,
"type": "string"
},
{
"description": "All modules are loaded upon startup. The last one is exported.",
"$ref": "#/definitions/common.nonEmptyArrayOfUniqueStringValues"
}
]
},
"description": "Multiple entry bundles are created. The key is the chunk name. The value can be a string or an array.",
"type": "object"
},
"data": {}
}).
object { <key>: non-empty string | [non-empty string] }
Multiple entry bundles are created. The key is the chunk name. The value can be a string or an array.
* configuration.entry should be a string.
* configuration.entry should be an array:
[non-empty string]
* configuration.entry should be an instance of function
function returning an entry object or a promise..
at webpack (/www/ckeditor5/ckeditor5-dev/packages/ckeditor5-dev-tests/node_modules/webpack/lib/webpack.js:20:9)
at new Plugin (/www/ckeditor5/ckeditor5-dev/packages/ckeditor5-dev-tests/node_modules/karma-webpack/lib/karma-webpack.js:63:18)
at invoke (/www/ckeditor5/ckeditor5-dev/packages/ckeditor5-dev-tests/node_modules/di/lib/injector.js:75:15)
at Array.instantiate (/www/ckeditor5/ckeditor5-dev/packages/ckeditor5-dev-tests/node_modules/di/lib/injector.js:59:20)
at get (/www/ckeditor5/ckeditor5-dev/packages/ckeditor5-dev-tests/node_modules/di/lib/injector.js:48:43)
at /www/ckeditor5/ckeditor5-dev/packages/ckeditor5-dev-tests/node_modules/di/lib/injector.js:71:14
at Array.map (native)
at Array.invoke (/www/ckeditor5/ckeditor5-dev/packages/ckeditor5-dev-tests/node_modules/di/lib/injector.js:70:31)
at Injector.get (/www/ckeditor5/ckeditor5-dev/packages/ckeditor5-dev-tests/node_modules/di/lib/injector.js:48:43)
at instantiatePreprocessor (/www/ckeditor5/ckeditor5-dev/packages/ckeditor5-dev-tests/node_modules/karma/lib/preprocessor.js:55:20)
at Array.forEach (native)
Expected/desired behavior:
It worked fine with Webpack 2.2.0-rc.3. Webpack either hasn’t been validating the entry option or the validation was more loose.
The config which karma-webpack passes to Webpack is this:
{ plugins: [ CKEditorWebpackPlugin { options: [Object] } ],
module: { rules: [ [Object], [Object] ] },
resolveLoader:
{ modules:
[ 'node_modules',
'/www/ckeditor5/ckeditor5-dev/packages/ckeditor5-dev-tests/node_modules' ] },
watch: true,
entry: {},
output:
{ path: '/_karma_webpack_/',
publicPath: '/_karma_webpack_/',
filename: '[name]',
chunkFilename: '[id].bundle.js' } }
The important part is entry: {}.
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 2
- Comments: 38 (23 by maintainers)
Commits related to this issue
- Fix: Webpack rc4 entry specific changes (fixes #193) (#194) — committed to codymikol/karma-webpack by gyandeeps 7 years ago
- fix(config): webpack rc4 schema enforcment (fixes #193) - defaults webpackOptions.entry to a function BREAKING CHANGE: Remove entry:{} from test configurations When updating to `"webpack": "2.2.0-... — committed to codymikol/karma-webpack by gyandeeps 7 years ago
Quick work around is
this way it works like it used to. This style was built for hot reloading stuff. I dont know if this a good long term solution.
Already done. I’m quick with that little green button of doom 😃
@gyandeeps - After a bit of discussion, the decision was made to make this a major after all.
Proper tag is cut here - https://github.com/webpack/karma-webpack/releases/tag/v2.0.1
@TheLarkInn should be pushing that up to npm shortly.
@mantupani17 Have you tried @gyandeeps solution? It worked for me. I’ve shortened it a bit by using arrow functions
No, limited number or people with npm access. Taking care of that now.
It’s a fix for a breaking change in Webpack ( technically ) not something I would cut a major for.
When using anything but rc.4 it behaves exactly as it did before as it’s just failing on schema validation in Webpack.
No this is exactly how we will fix it. Thank you for posting this workaround.