鍍金池/ 問答/HTML5  PHP  HTML/ vue-cli,在本地運行正常,但打包后資源無法找到的問題

vue-cli,在本地運行正常,但打包后資源無法找到的問題

由于項目需要問題,我的項目文件下還有好幾個文件夾與js文件,項目結(jié)構(gòu)大概如此

clipboard.png

clipboard.png
本地是可以正常訪問的,但是打包后卻提示我另外加入的靜態(tài)資源找不到

clipboard.png
并且還有一個報錯,估計是因為找不到文件引發(fā)的,請問我應(yīng)該如何配置

index.js下的配置:`build: {

env: require('./prod.env'),
// Template for index.html
index: path.resolve(__dirname, '../dist/index.html'),

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

/**
 * Source Maps
 */

productionSourceMap: false,
// 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

}`

回答
編輯回答
兮顏

可能要注意服務(wù)端的訪問路徑,你編譯后,在服務(wù)端的路徑和本地時有出入的

2017年2月14日 21:22