如何在一个文件夹中构建一个带有索引,css和js的vue.js项目

时间:2018-04-03 16:16:19

标签: webpack vue.js

我使用“vue init webpack my-project”创建了一个vue.js项目。当我执行“npm run build”时,它会在dist文件夹中创建js和css目录。我希望所有文件都存在于根文件夹中。这可能吗?

这是我的config / index.js:

const path = require('path')

module.exports = {

  build: {
    // Template for index.html
    index: path.resolve(__dirname, '../dist/index.html'),

    // Paths
    assetsRoot: path.resolve(__dirname, '../dist'),
    assetsSubDirectory: '',
    assetsPublicPath: '',

    /**
     * Source Maps
     */

    productionSourceMap: true,
    // https://webpack.js.org/configuration/devtool/#production
    devtool: '#source-map',

    // Gzip off by default as many popular static hosts such as
    // Surge or Netlify already gzip all static assets for you.
    // Before setting to `true`, make sure to:
    // npm install --save-dev compression-webpack-plugin
    productionGzip: true,
    productionGzipExtensions: ['js', 'css'],

    // Run the build command with an extra argument to
    // View the bundle analyzer report after build finishes:
    // `npm run build --report`
    // Set to `true` or `false` to always turn it on or off
    bundleAnalyzerReport: process.env.npm_config_report
  }
}

0 个答案:

没有答案