1、VSCode中build後,index.html中引入js錯誤
Failed to load resource: net::ERR_FILE_NOT_FOUND
2、需要配置vue.config.js
在vue-cli3需要手動在工程目錄下建立vue.config.js
vue.config.js中配置如下即可:
module.exports = {
publicPath: './'
}
3、配置vue.config.js後,再運行npm run build出現如下錯誤
These dependencies were not found:
* XXXXX \src\index\main.js in multi ./src/index/main.js
* XXXXX \src\subpage\main.js in multi ./src/subpage/main.js
使用:webpack .\src\main.js -o .\dist\bundle.js
4、webpack : 無法加載文件 D:\nodejs\node_modules\npm_global\webpack.ps1,因爲在此係統上禁止運行腳本。
查看運行權限:get-ExecutionPolicy
設置運行權限:set-ExecutionPolicy RemoteSigned,或者:Set-ExecutionPolicy -Scope CurrentUser,再輸入RemoteSigned