vue-cli3+打包时css样式出现偏差主要是因为css打包时被分割了
我们只要在 vue.config.js里加上 css: { extract: false, sourceMap: false },让css不要分割打包
const { defineConfig } = require("@vue/cli-service");
module.exports = defineConfig({
transpileDependencies: true,
lintOnSave: false,
publicPath: '/***/',
outputDir: 'dist',
assetsDir: 'assets',
indexPath: 'pages/index.html',
productionSourceMap: false,
css: { extract: false, sourceMap: false },
chainWebpack: config => {
config.plugin('html')
.tap(args => {
args[0].title = "****";
return args;
})
}
});