【VUE】vue打包后引入js和css用相对路径引入

解决方案 vue.config.js

module.exports = {
  publicPath: process.env.NODE_ENV === 'development' ? './' : '././',
  outputDir: 'dist'
}

原因 loadUserOptions

// normalize some options
    ensureSlash(resolved, 'publicPath')
    if (typeof resolved.publicPath === 'string') {
      resolved.publicPath = resolved.publicPath.replace(/^\.\//, '')
    }