webpack config missing in vuejs

前端 未结 1 795
小鲜肉
小鲜肉 2021-02-13 21:48

My vuejs app\'s package.json looks like

package.json

{
  \"name\": \"vue_app\",
  \"version\": \"0.1.0\",
  \"private\": true,
  \"scripts\"         


        
1条回答
  •  执念已碎
    2021-02-13 22:45

    In vue cli 3 the webpack config file is generated dynamically at runtime. It has been abstracted away. That is the reason you don't see a webpack config file.

    You can find the webpack config file here:

    /node_modules/@vue/cli-service/webpack.config.js
    

    This is the file that is dynamically resolved.

    The output.publiPath is / by default in the webpack config file. If you want to check want is webpack config file looks like you can use vue inspect command in your command line or via vue ui -> click Tasks -> click inspect. It prints out a serialized format only meant for inspection of the config file.

    But if you want to configure the webpack config you can make use of the vue.config.js file.

    If you do not have vue.config.js file, then create it in root of your project.

    Then add the following:

    // vue.config.js
    module.exports = {
        configureWebpack: {
            output: {
                publicPath: '/static/'
            }
        }
    }
    

    Resources:

    • Vue-Cli 3 docs
    • Configuring Webpack

    0 讨论(0)
提交回复
热议问题