美文网首页
vue-cli3.x vue.config.js

vue-cli3.x vue.config.js

作者: _ing_f909 | 来源:发表于2020-08-11 11:54 被阅读0次

    const Timestamp = new Date().getTime();

    module.exports = {

      publicPath: './', // '/'history'模式

      outputDir: 'dist', // 构建时输出目录

      assetsDir: 'static', // 静态资源存放目录

      filenameHashing: true, // 文件名哈希

      productionSourceMap: false,

      indexPath: 'index.html', // 文件输出名

      pages: {

        index: {

          entry: 'src/main.js',

          template: './index.html', // 模板文件

          filename: 'index.html',

          title: 'Signal Supervisor',

          chunks: ['chunk-vendors', 'chunk-common', 'index']

        }

      },

      configureWebpack: {

        output: { // 输出重构  打包编译后的 文件名称  【模块名称.时间戳】

          filename: `static/js/[name].${Timestamp}.js`,

          chunkFilename: `static/js/[name].${Timestamp}.js`

        },

      },

      css: {

        loaderOptions: {

          less: {

            // 若使用 less-loader@5,请移除 lessOptions 这一级,直接配置选项。

            lessOptions: {

              modifyVars: {

                // 或者可以通过 less 文件覆盖(文件路径为绝对路径)

                hack: `true; @import "./src/assets/css/reset.less";`,

              },

            },

          },

        // 使用vant时对vant样式的尺寸进行忽略

            postcss: {

                  plugins: [

                      require('postcss-pxtorem')({ // 把px单位换算成rem单位

                          rootValue: 75, // 换算的基数(设计图750的根字体为75)

                          propList: ['*'],

                          exclude: /vant/ // 设置不匹配项

                      })

                  ]

              },

        },

      }

    };

    相关文章

      网友评论

          本文标题:vue-cli3.x vue.config.js

          本文链接:https://www.haomeiwen.com/subject/kjwedktx.html