0

I'm getting the following error when trying to set up webpack for CSS Modules...

Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema. - configuration.output.path: The provided value "build" is not an absolute path! -> The output directory as absolute path (required).

Following are my webpack.config.js and package.json files.

webpack.config.js

module.exports = {
  entry: './src',
  output: {
    path: 'build',
    filename: 'bundle.js',
  },
};

package.json

{
  "name": "css-modules",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "start": "webpack && open index.html"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "webpack": "^4.16.1",
    "webpack-cli": "^3.0.8"
  }
}

If anyone could help it would be appreciated.

Thanks!

Drostan
  • 1,809
  • 3
  • 16
  • 22
  • Possible duplicate of https://stackoverflow.com/q/42166492/6816939 – Ragul Parani Jul 17 '18 at 09:32
  • Possible duplicate of [Getting "Error: \`output.path\` needs to be an absolute path or \`/\`"](https://stackoverflow.com/questions/42166492/getting-error-output-path-needs-to-be-an-absolute-path-or) – Ragul Parani Jul 17 '18 at 09:32

1 Answers1

1

You need to give the absolute path instead of 'build'.

Use path: path.join(__dirname, 'build') instead

Saransh Kataria
  • 1,447
  • 12
  • 19