Can't build using vue2-sfc-loader ESM with rollup/vite
See original GitHub issueDescribe the bug
I try to build an app using vue2-sfc-loader (esm) and vite.
It works properly in dev mode, but when building the app, it fails. Vite is building with rollup under the hood, so it may likely be a configuration issue, but I can’t understand the following error.
[commonjs] Unexpected token (15:124277) in /home/toilal/projects/OFB-ESTAMP/frontend-vite/node_modules/vue3-sfc-loader/dist/vue2-sfc-loader.esm.js
To Reproduce
Expected behavior
Versions
- Browser (name & version):
- vue2-sfc-loader: v0.7.3
Additional context
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Make Vite work with Vue 2 · Issue #305 · vitejs/vite - GitHub
It doesn't work with Vue 2 and vue-template-compiler isn't the right package. So the error is correct. Use Vue 3 and it will...
Read more >Error : vue-loader requires @vue/compiler-sfc to be present in ...
Looks like you are trying to use vue-loader from Vue 3 in Vue 2 project. Here is a versions I have for Vue...
Read more >Plugin API - Vite
Virtual modules are a useful scheme that allows you to pass build time information to the source files using normal ESM import syntax....
Read more >How to Migrate from Vue CLI to Vite - Vue School Blog
Step #1: Updating Dependencies ... The first step to migrating to Vite is to update the dependencies in package.json. We'll need to remove...
Read more >Single file components | Vue I18n - Intlify
If you are building Vue component or Vue application using single file ... vite: v2-beta or later; @vitejs/plugin-vue: v1.0.4 or later.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yes, it works now ! Thanks
Le dim. 11 juil. 2021 à 09:21, Franck Freiburger @.***> a écrit :
using the dev version of
vue3-sfc-loader
:https://github.com/defunctzombie/node-process/blob/master/browser.js#L157
Maybe rollup tries to replace
process.env
with another expression that is not suitable for assignment (eg.{} = {}
) ?note that using
process.env = {};
somewhere in the code compiled by vite is enough to rise this issue !