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.

[vite 3.0.7] Vue is not correctly imported in production

See original GitHub issue

Describe the bug

I import vue and a 3rd package portal-vue. It works fine in dev, but raises the following error if I preview the bundle built:

Vue.extend is not a function

This bug looks very similar to an issue vitejs/vite-plugin-vue#34 I reported previously but occurs only since v3.0.6.

✔️Vite v3.0.5 dev ✔️Vite v3.0.5 production ✔️Vite v3.0.6 v3.0.7 dev ❌Vite v3.0.6 v3.0.7 production

Reproduction

https://stackblitz.com/edit/vitejs-vite-e9wniz

System Info

System:
    OS: Linux 5.0 undefined
    CPU: (4) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 0 Bytes / 0 Bytes
    Shell: 1.0 - /bin/jsh
  Binaries:
    Node: 16.14.2 - /usr/local/bin/node
    Yarn: 1.22.10 - /bin/yarn
    npm: 7.17.0 - /bin/npm
  npmPackages:
    vite: ^3.0.7 => 3.0.7

Used Package Manager

pnpm

Logs

No response

Validations

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
kingyue737commented, Aug 16, 2022

Thanks for the patch! fixed in 3.0.8

1reaction
sodateacommented, Aug 16, 2022

Likely fixed by https://github.com/vitejs/vite/pull/9653, pending a new patch release

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshooting - Vite
As Vite does not bundle most of the files, browsers may request many files which require many file ... You may be importing...
Read more >
Vue 3 - Vite app missing some CSS rules after build
When building for production, it removes CSS rules that are not being used. There are some libraries that concatenate CSS class names using ......
Read more >
Vite JS – The Installation Guide - Radixweb
Want to install ViteJS into your system? Here is a detailed installation guide on how to install Vite JS in your preferred environment....
Read more >
Migrating From Vue-CLI & Webpack to Vitejs - Boot.dev
Vite explicitly requires that all .vue imports include the .vue in the path. This can be a bit tedious if you haven't been...
Read more >
The missing migration guide: from Vue CLI to Vite - Moiva.io
Hence style definitions for classes from that file were not included in the production build. The problem was fixed easily by tweaking the ......
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