国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 語言 > JavaScript > 正文

修改vue+webpack run build的路徑方法

2024-05-06 15:30:47
字體:
來源:轉載
供稿:網友

vue項目用webpack打包想要修改靜態資源路徑等,找到項目根目錄下的config文件夾,打開該文件夾下的index.js文件,默認如下:

// see http://vuejs-templates.github.io/webpack for documentation.var path = require('path')module.exports = { build: { env: require('./prod.env'), index: path.resolve(__dirname, '../dist/index.html'), assetsRoot: path.resolve(__dirname, '../dist'), assetsSubDirectory: 'static', assetsPublicPath: '/', productionSourceMap: true, // 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 }, dev: { env: require('./dev.env'), port: 8080, autoOpenBrowser: true, assetsSubDirectory: 'static', assetsPublicPath: '/', proxyTable: {}, // CSS Sourcemaps off by default because relative paths are "buggy" // with this option, according to the CSS-Loader README // (https://github.com/webpack/css-loader#sourcemaps) // In our experience, they generally work as expected, // just be aware of this issue when enabling this option. cssSourceMap: false }}

其中build.index:必須是本地文件系統上的絕對路徑。會生成index.html文件。

build.assetsRoot:必須是本地文件系統上的絕對路徑。

build.assetsSubDirectory:編譯出來的資源文件。

build.assetsPublicPath:【資源的根目錄】,這是通過http服務器運行的url路徑。默認情況下,是根目錄(/)。如果后臺對靜態資源url前綴要求,則需要改變這個路徑。

build.productionSourceMap:在構建生產環境版本時是否開啟source map。

以上這篇修改vue+webpack run build的路徑方法就是小編分享給大家的全部內容了,希望能給大家一個參考,也希望大家多多支持錯新站長站。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表

圖片精選

主站蜘蛛池模板: 五莲县| 霸州市| 西华县| 榆林市| 饶河县| 凉城县| 开远市| 淅川县| 阿克陶县| 南郑县| 内丘县| 大悟县| 印江| 奈曼旗| 桓台县| 社旗县| 临海市| 延津县| 赤峰市| 皋兰县| 弥勒县| 海伦市| 会泽县| 保德县| 昌宁县| 承德县| 广饶县| 绥棱县| 当阳市| 岑溪市| 平武县| 天峻县| 麦盖提县| 凉城县| 临夏市| 布尔津县| 汝城县| 康乐县| 抚顺市| 宿州市| 偃师市|