Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: process is not defined in browser when using Vite #200

Closed
asiaziola opened this issue Jul 19, 2022 · 0 comments · Fixed by #199
Closed

bug: process is not defined in browser when using Vite #200

asiaziola opened this issue Jul 19, 2022 · 0 comments · Fixed by #199
Assignees
Labels
bug Something isn't working

Comments

@asiaziola
Copy link
Contributor

asiaziola commented Jul 19, 2022

Warp is using browser field in package.json to exclude some of the modules (including vm2 library which is used only in server environment). It works fine in the bundles I've tested (webpack, parcel and web bundles). Seems that vite is not interpreting this field properly. Check out e.g. this issue - vitejs/vite#7576. Vite seems to have a fix for this but it's not yet merged - vitejs/vite#8709. I seems to be more vite-side problem. We should wait for the mentioned fix. However, we can by make Warp working in vite by adding vm2 to exclude array in vite.config.ts

Screenshot 2022-07-19 at 10 30 57

export default defineConfig({
  plugins: [vue()],
  optimizeDeps: {
    exclude: ['vm2'],
  },
});

Additionally, we should change how VM2 is imported and not import its modules directly.

@asiaziola asiaziola self-assigned this Jul 19, 2022
@asiaziola asiaziola added the bug Something isn't working label Jul 19, 2022
@asiaziola asiaziola linked a pull request Jul 19, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant