Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

webpack entry module not found

When I run webpack, I get this error:

ERROR in Entry module not found: Error: Cannot resolve module 'game'
in /Users/frederikcreemers/dev/dark_chess

(newline added for clarity.)

But I'm certain that game.js exists.

Here's what my webpack.config.js looks like:

module.exports = {
    entry: "game.js",
    output: {
        path: __dirname + "build",
        filename: "index.js"
    },
    module: {
        loaders: [
            { test: /\.css$/, loader: "style!css" },
            { test: /\.jsx?$/, loader: "babel?presets[]=es2015", exclude: /(node_modules|bower_components)/}
        ]
    }
};

I'm not sure how to further investigate the issue.

like image 978
bigblind Avatar asked Jan 02 '16 20:01

bigblind


1 Answers

The webpack entry option usually resolves to a File Module.

So, probably what you need is to indicate the relative path to your game.js file module:

entry: "./game.js",

Otherwise webpack will try to load it as a core module or from node_modules folder.

Without a leading '/', './', or '../' to indicate a file, the module must either be a core module or is loaded from a node_modules folder.

like image 163
dreyescat Avatar answered Nov 15 '22 08:11

dreyescat