zoukankan      html  css  js  c++  java
  • npm run build后如何打开index.html跑起项目

    Tip: built files are meant to be served over an HTTP server.   Opening index.html over file:// won't work.

    提示:构建的文件应该通过HTTP服务器提供服务。在文件:/上打开index.html不起作用。

    其实直接本地就可以打开。。。

    只需要在build配置文件修改:

    assetsPublicPath: './',
     
      build: {
        // Template for index.html
        index: path.resolve(__dirname, '../dist/index.html'),
    
        // Paths
        assetsRoot: path.resolve(__dirname, '../dist'),
        assetsSubDirectory: 'static',
        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: false,
        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
      }
  • 相关阅读:
    补结对编程四则运算(结对伙伴)
    alpha发布(技术随笔)
    第四周 更新Scrum站立会议
    第四周 技术随笔psp
    第四周 课堂Scrum站立会议
    更新-补四则运算(结对编程)
    补交git、ssh
    补第二周四人小组WBS/NABCD
    补充第二周燃尽图
    修改第二周站立会议
  • 原文地址:https://www.cnblogs.com/ivan5277/p/10829253.html
Copyright © 2011-2022 走看看