Vue-CLI 3.0 - 如何更改生产链接?
Vue-CLI 3.0 - how can I change the production links?
默认在dist/index.html创建这样的链接:
<link href=/js/app.2e806e0c.js rel=preload as=script>
<link href=/js/chunk-vendors.bc9ee6a2.js rel=preload as=script>
<link href=/css/chunk-vendors.fc712ce5.css rel=stylesheet>
<link href=/css/app.64eef18a.css rel=stylesheet>
<script src=/js/chunk-vendors.bc9ee6a2.js></script>
<script src=/js/app.2e806e0c.js></script>
如何更改指向此链接的链接?
<link href=js/app.2e806e0c.js rel=preload as=script>
<link href=js/chunk-vendors.bc9ee6a2.js rel=preload as=script>
<link href=css/chunk-vendors.fc712ce5.css rel=stylesheet>
<link href=css/app.64eef18a.css rel=stylesheet>
<script src=js/chunk-vendors.bc9ee6a2.js></script>
<script src=js/app.2e806e0c.js></script>
对于Vue CLI 3.3+参考
您可以通过 baseUrl
选项更改此设置,您必须在项目根目录的 vue.config.js
文件中进行设置:
module.exports = {
baseUrl: ''
};
以下是 , baseUrl
is now deprecated, you should use publicPath
的回答:
module.exports = {
publicPath: ""
};
默认在dist/index.html创建这样的链接:
<link href=/js/app.2e806e0c.js rel=preload as=script>
<link href=/js/chunk-vendors.bc9ee6a2.js rel=preload as=script>
<link href=/css/chunk-vendors.fc712ce5.css rel=stylesheet>
<link href=/css/app.64eef18a.css rel=stylesheet>
<script src=/js/chunk-vendors.bc9ee6a2.js></script>
<script src=/js/app.2e806e0c.js></script>
如何更改指向此链接的链接?
<link href=js/app.2e806e0c.js rel=preload as=script>
<link href=js/chunk-vendors.bc9ee6a2.js rel=preload as=script>
<link href=css/chunk-vendors.fc712ce5.css rel=stylesheet>
<link href=css/app.64eef18a.css rel=stylesheet>
<script src=js/chunk-vendors.bc9ee6a2.js></script>
<script src=js/app.2e806e0c.js></script>
对于Vue CLI 3.3+参考
您可以通过 baseUrl
选项更改此设置,您必须在项目根目录的 vue.config.js
文件中进行设置:
module.exports = {
baseUrl: ''
};
以下是 baseUrl
is now deprecated, you should use publicPath
的回答:
module.exports = {
publicPath: ""
};