npm run build后如何打开index.html跑起项目
生活随笔
收集整理的這篇文章主要介紹了
npm run build后如何打开index.html跑起项目
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
Tip: built files are meant to be served over an HTTP server.? ?Opening index.html over file:// won't work.
提示:構(gòu)建的文件應(yīng)該通過HTTP服務(wù)器提供服務(wù)。在文件:/上打開index.html不起作用。
?
其實(shí)直接本地就可以打開。。。
只需要在build配置文件修改:
assetsPublicPath: './', build: {// Template for index.htmlindex: path.resolve(__dirname, '../dist/index.html'),// PathsassetsRoot: path.resolve(__dirname, '../dist'),assetsSubDirectory: 'static',assetsPublicPath: './',/*** Source Maps*/productionSourceMap: true,// https://webpack.js.org/configuration/devtool/#productiondevtool: '#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-pluginproductionGzip: 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 offbundleAnalyzerReport: process.env.npm_config_report}?
轉(zhuǎn)載于:https://www.cnblogs.com/ivan5277/p/10829253.html
創(chuàng)作挑戰(zhàn)賽新人創(chuàng)作獎勵來咯,堅持創(chuàng)作打卡瓜分現(xiàn)金大獎總結(jié)
以上是生活随笔為你收集整理的npm run build后如何打开index.html跑起项目的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 开源视觉salm算法介绍
- 下一篇: 大数据技术原理与应用:期末考点总结