Vue3 + Vite web component bundling - process is not defined #8322
-
Minimal reproductionhttps://github.com/silvester-pari/vite-vue3-webcomponent QuestionHello, I am following this guide to create web components with vue (using SFC), and displaying them in the dev preview works fine. When bundling, however, I run into the console error I tried setting
in the vite.config.js as indicated by other sources, but this did not help. It produces a different error when running the build command:
I have seen vitejs/vite#1973 and vitejs/vite#2278 and https://stackoverflow.com/questions/72628089/error-in-vite-preview-uncaught-in-promise-referenceerror-process-is-not-def, but I have not had luck so far. Is there any example of Vue3 and Vite actually working to create a web component, including bundling? Any help is appreciated, thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
// vite.config.ts
define: {
"process.env.NODE_ENV": JSON.stringify(process.env.NODE_ENV),
}, If this can help you solve the problem, I hope it can be marked as the answer. In addition, I think this question should appear in the discussion area of |
Beta Was this translation helpful? Give feedback.
If this can help you solve the problem, I hope it can be marked as the answer. In addition, I think this question should appear in the discussion area of
vite
, notvue
.