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

configuration misses the property 'entry'. #144

Closed
NN--- opened this issue May 15, 2017 · 14 comments
Closed

configuration misses the property 'entry'. #144

NN--- opened this issue May 15, 2017 · 14 comments

Comments

@NN---
Copy link

NN--- commented May 15, 2017

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?

@evenstensberg
Copy link
Member

Hi! Sending this over to @okonet & @pksjce to consideration! Thanks for submitting!

@okonet
Copy link
Contributor

okonet commented May 21, 2017

@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?

@evenstensberg
Copy link
Member

Well it's just looking at the source code. It's at our repo. Should be doable.

@conor909
Copy link

conor909 commented Jun 24, 2017

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)).*/
      })
    ]
  }
}

@evenstensberg
Copy link
Member

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

@evenstensberg
Copy link
Member

Oh wait, @conor909 are you trying to run webpack migrate ? From webpack itself?

@conor909
Copy link

I'm not sure what webpack migrate is so no I dont think so

@evenstensberg
Copy link
Member

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.

skjermbilde 2016-06-18 kl 15 50 31

@evenstensberg
Copy link
Member

Also try to remove the dev-server entry: https://github.com/glenjamin/webpack-hot-middleware#200

@kentcdodds
Copy link
Member

You might also want to check out http://npm.im/webpack-config-utils which includes those utils and more 👌

@conor909
Copy link

conor909 commented Jun 26, 2017

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

@evenstensberg
Copy link
Member

@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 ✌️

@evenstensberg
Copy link
Member

@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 😭

@must19
Copy link

must19 commented Mar 22, 2019

I came with this issue while trying to configure one of my projects. @conor909 post resolved this for me. thanks

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

7 participants