unplugin-vue2-script-setup: Cannot set properties of undefined (setting'render').
Hello, I encountered a problem when using Vue-cli to package into the production environment: Cannot set properties of undefined (setting’render’).
The following are my few file configurations:
package.json
{
"name": "vue-cli",
"private": true,
"scripts": {
"dev": "vue-cli-service serve",
"build": "vue-tsc --noEmit && vue-cli-service build",
"lint": "vue-cli-service lint"
},
"dependencies": {
"@vue/composition-api": "^1.2.4",
"core-js": "^3.16.4",
"vue": "^2.6.11"
},
"devDependencies": {
"@vue/cli-plugin-babel": "^4.5.13",
"@vue/cli-plugin-typescript": "^4.5.13",
"@vue/cli-service": "^4.5.13",
"typescript": "^4.4.2",
"unplugin-vue2-script-setup": "workspace:*",
"vue-template-compiler": "^2.6.14",
"vue-tsc": "^0.3.0"
}
}
vue.config.js
/* eslint-disable @typescript-eslint/no-var-requires */
const ScriptSetup = require('unplugin-vue2-script-setup/webpack')
/**
* @type {import('@vue/cli-service').ProjectOptions}
*/
module.exports = {
configureWebpack: {
plugins: [
ScriptSetup({
refTransform: true,
}),
],
},
chainWebpack(config) {
// disable type check and let `vue-tsc` handles it
config.plugins.delete('fork-ts-checker')
// disable cache for testing, you should remove this in production
config.module.rule('vue').uses.delete('cache-loader')
config.module.rule('js').uses.delete('cache-loader')
config.module.rule('ts').uses.delete('cache-loader')
config.module.rule('tsx').uses.delete('cache-loader')
},
}
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 15 (3 by maintainers)
This plugin is conflicting with
thread-loader
for some reason, the current workaround is passingparallel: false
in yourvue.config.js
@antfu First of all, I am really sorry for not providing a detailed example.
The following is my system information:
I have provided a link to the project, hoping to find the problem.
https://github.com/maomincoding/vue2-cli-script-setup
I found the problem like this:
1. First I run the command
2. Startup project
There is no problem in the development environment.
3. Deploy to production environment
At this time, I found this error in the production environment.
The above is the problem I encountered, thanks.
We temporarily close this due to the lack of enough information. Please provide a minimal reproduction to reopen the issue. Thanks.