question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot set properties of undefined (setting'render').

See original GitHub issue

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')
  },
}

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:15 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
antfucommented, Nov 2, 2021

This plugin is conflicting with thread-loader for some reason, the current workaround is passing parallel: false in your vue.config.js

3reactions
maomincodingcommented, Nov 2, 2021

@antfu First of all, I am really sorry for not providing a detailed example.

The following is my system information:

  • System: OS: Windows 10 10.0.19041 CPU: (8) x64 Intel® Core™ i7-10510U CPU @ 1.80GHz Memory: 6.84 GB / 15.84 GB
  • Binaries: Node: 14.15.0 - C:\Program Files\nodejs\node.EXE Yarn: 1.22.10 - ~\AppData\Roaming\npm\yarn.CMD npm: 6.14.8 - C:\Program Files\nodejs\npm.CMD
  • Browsers: Edge: Spartan (44.19041.1266.0), Chromium (95.0.1020.40) Internet Explorer: 11.0.19041.1202

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

yarn

2. Startup project

yarn dev

There is no problem in the development environment.

微信截图_20211102103510

3. Deploy to production environment

yarn build

At this time, I found this error in the production environment.

微信截图_20211102103202


The above is the problem I encountered, thanks.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Uncaught TypeError: Cannot Set Property 'Render' of Undefined
I fixed up my code and received this error: Error in render: "TypeError: Cannot read property 'toLowerCase' of undefined". But as for the...
Read more >
Solution to Vue.js TypeError: Cannot set property 'render' of ...
Turns out I accidentally removed the export from my App.vue file. To solve, open your App.vue file and make sure App is being...
Read more >
Uncaught TypeError: Cannot set property 'render' of undefined
My App.vue does have a default export. So do all other .vue files. <script lang="ts"> import Vue from 'vue'; import { Component, Prop...
Read more >
[Solved]-why i get, Cannot set property of undefined-Vue.js
Just change this part: this.$axios.$get('mydomain.com' + customerId).then(function (data) { this.formFields = data.customers[0] }). To this: this.$axios.
Read more >
vue typeerror: cannot set properties of undefined - You.com
Feb 11, 2019 ... Solution to Vue.js TypeError: Cannot set property 'render' of undefined ... Turns out I accidentally removed the export from...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found