Saturday, 27 May 2017

Can't resolve module.js

I have the following directory structure:

package.json
project
  src
    webpack.conf.js
    index.js

I want to be able to run webpack --config project/src/webpack.conf.js from the root level, but it gives me errors, either that it can't resolve the entry file, or can't resolve module.js from webpack node_modules folder.

My webpack.conf.js:

module.exports = {
  context: process.cwd() + "/project",
  entry: "./src/index.js",
  target: "node",
  resolve: {
    extensions: ['.js'],
  }
};

It works perfectly when I run it from project location, but doesn't work when I run it from root. What's wrong?



via user99999

No comments:

Post a Comment