undefinedfix
Sign in

Vue-cli3 CSS packing path

Bonovski edited in Sun, 25 Sep 2022

The CSS file needs to be placed on another server separately, so you need to modify the packaged CSS address,

Assetsdir is used to configure all files, but only the CSS file address needs to be configured

After vue-cli3 is packaged, the import address of CSS file needs to be modified, and other JS files do not need to be modified.

Now it's configured like this

Packed address with a/

clipboard.png

1 Replies
Smit
commented on Mon, 26 Sep 2022
<script src="<%= BASE_URL %>js/bestime.min.js"></script>
<script src="<%= BASE_URL %>js/jquery1.9.1.min.js"></script>
// vue.config.js
module.exports = {
    publicPath: process.env.NODE_ENV === 'production'
    ? 'http://www.baidu.com'
    : '/',
}
// 结果
<script src="http://www.baidu.com/js/bestime.min.js"></script>
<script src="http://www.baidu.com/js/jquery1.9.1.min.js"></script>