Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Location of webpack config file in vue-cli webpack project?

I used cli to create a vue.js project. I used the webpack template for it. I have been working on it for a few days and it working smoothly.

Now I need to add a npm package to the project. This package recommends I make some changes to webpack config. But there is not webpack.config.js file at the root of my project. Where is the webpack config file. Do i need to run a command to publish it like in some frameworks.

like image 839
Ragas Avatar asked Nov 30 '17 06:11

Ragas


1 Answers

If you create your project with the new vue-cli 3 (@vue/cli) will be a file called vue.config.js in your project root directory. It means that you can customize your webpack configs just changing the vue.config.js, that it was automaticaly included in your project root directory, as follows:

module.exports = {
  configureWebpack: {
    // It will be merged into the final Webpack config
    plugins: [
      ... // Your plugins here...
    ]
  }
}

So easy! Long life to new vue-cli approach!

like image 108
Lindoélio Lázaro Avatar answered Sep 18 '22 17:09

Lindoélio Lázaro