I have a webpack configuration which is merged with other:
var commonConfig = require("./webpack.common.config.js");
var webpack = require("webpack");
var merge = require("webpack-merge");
var CopyWebpackPlugin = require("copy-webpack-plugin");
var resourcesFolder = "resources";
module.exports = merge(commonConfig, {
entry: {
....
}
});
When I run webpack-cli --migrate I get:
WebpackOptionsValidationError: Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
- configuration misses the property 'entry'.
object { <key>: non-empty string | [non-empty string] } | non-empty string | [non-empty string] | function
The entry point(s) of the compilation.
Can you support this scenario too?
Hi! Sending this over to @okonet & @pksjce to consideration! Thanks for submitting!
@ev1stensberg @sokra does WebpackOptionsValidation accepts non-objects? I don't think so but wanted to ping you to see how hard it can be to support such cases?
Well it's just looking at the source code. It's at our repo. Should be doable.
I'm getting the same error
I'm testing out dev / prod config files using the method from the docs here https://webpack.js.org/guides/production/#simple-approach
But when I switch my base config to a function I get the following error
WebpackOptionsValidationError: Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
- configuration misses the property 'entry'.
Im using
webpack 3.0.0
npm 5.0.3
node 6.11.0
Original webpack.config.js <- this works
const path = require('path');
const webpack = require('webpack');
module.exports = {
entry: [
'webpack/hot/dev-server',
'webpack-hot-middleware/client',
'./src/index.js'
],
output: {
publicPath: '/',
path: path.join(__dirname, 'build/static'),
filename: 'jb.js'
},
watch: true,
module: {
loaders: [
{
test: /\.js$/,
loaders: ['react-hot-loader', 'babel-loader'],
exclude: /node_modules/,
include: __dirname
}
]
},
plugins: [
new webpack.HotModuleReplacementPlugin({
// exclude hot-update files
test: /^(?!.*(hot)).*/
})
]
}
Base config as a function <- this causes the error
const path = require('path');
const webpack = require('webpack');
module.exports = (env) => {
return {
entry: [
'webpack/hot/dev-server',
'webpack-hot-middleware/client',
'./src/index.js'
],
output: {
publicPath: '/',
path: path.join(__dirname, 'build/static'),
filename: 'jb.js'
},
watch: true,
module: {
loaders: [
{
test: /\.js$/,
loaders: ['react-hot-loader', 'babel-loader'],
exclude: /node_modules/,
include: __dirname
}
]
},
plugins: [
new webpack.HotModuleReplacementPlugin({
test: /^(?!.*(hot)).*/
})
]
}
}
Hmm, weird, this should definitely work. Try not using a return, what do you get? A stack tracke would be fine, do node your/path/node_modules/webpack/bin/webpack.js --stack-trace-limit 9000
Oh wait, @conor909 are you trying to run webpack migrate ? From webpack itself?
I'm not sure what webpack migrate is so no I dont think so
Ok, gotcha :) Which command are you trying to run? Just webpack ? If so, could you try to do the debug as I mentioned earlier?
This is taken from @kentcdodds 's course on webpack-2, which should be valid.

Also try to remove the dev-server entry: https://github.com/glenjamin/webpack-hot-middleware#200
You might also want to check out http://npm.im/webpack-config-utils which includes those utils and more 馃憣
I'm just running an npm start command which runs the entry to the server and allow es6 with babel. The command I'm running is: node_modules/babel-cli/bin/babel-node.js ./server/server.js
@conor909 I'll try to get a repro up today and try to figure out what's wrong. At first glance this seems like it should work though 鉁岋笍
@conor909 I think this is due that webpack is validating your config and expects an object to be passed into it, like we're doing with migrate. So this won't work for a config that has a function. Anyways, we're revamping some logic in v2, and it should (hopefully) work!
Sorry for getting back to you so late, its been a hectic semester 馃槶
I came with this issue while trying to configure one of my projects. @conor909 post resolved this for me. thanks
Most helpful comment
@conor909 I'll try to get a repro up today and try to figure out what's wrong. At first glance this seems like it should work though 鉁岋笍