Vue2迁移Vue3构建报错:TypeError: 无法读取undefined的styles属性
Vue2迁移Vue3构建报错:TypeError: Cannot read properties of undefined (reading 'styles')
正在使用迁移工具将项目从Vue2迁移至Vue3,执行构建时出现如下错误:
Syntax Error: TypeError: Cannot read properties of undefined (reading 'styles')
项目package.json依赖内容:
"dependencies": { "@game-streaming/game-streaming-vue-body-class-configure": "*", "@vue/compat": "^3.1.0", "vue": "^3.1.0", "vue-loader": "^16.0.0" }, "devDependencies": { "@game-streaming/eslint-config-game-streaming": "*", "@types/node": "^17.0.17", "@vue/cli-plugin-eslint": "~5.0.0", "@vue/cli-plugin-typescript": "~5.0.0", "@vue/cli-service": "~5.0.0", "@vue/compiler-sfc": "^3.5.12", "@vue/eslint-config-typescript": "^9.1.0", "eslint-plugin-vue": "^9.9.0", "ts-node": "^10.9.1", "typescript": "~4.5.5" },
vue.config.js配置内容:
module.exports = { configureWebpack: { resolve: { alias: { // eslint-disable-next-line global-require,@typescript-eslint/no-var-requires '@': require('path').join(__dirname, 'src'), }, }, module: { rules: [ { test: /\.vue$/, use: 'vue-loader', }, ], }, }, chainWebpack: (config) => { config.resolve.alias.set('vue', '@vue/compat'); config.module .rule('vue') .use('vue-loader') .tap((options) => ({ ...options, compilerOptions: { compatConfig: { MODE: 3, }, }, })); }, };
已经尝试使用vue-loader v16版本,猜测问题可能和过时的vue-loader库有关,但不确定,寻求解决帮助。
内容的提问来源于stack exchange,提问作者Rae
相关产品推荐
相关产品推荐

