You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So all of these packages are NodeJs packages and we use them only if the code is running by NodeJS.
If code is running by browser, we don't want those packages to be at the final bundle as it increases bundle size.
Webpack respects this field, however, vitejs doesn't.
Is it possible to support this field or did I miss some additional configuration?
Even injected polyfill doesn't work well as it's kind of proxy and doesn't have named imports
original code
import { inspect } from 'util'
build code
import { inspect } from '/@id/__vite-browser-external'
an error
values.js?t=1617178902155:4 Uncaught SyntaxError: The requested module '/@id/__vite-browser-external' does not provide an export named 'inspect'
Hello @fireridlle. Please provide a online reproduction by codesandbox or a minimal GitHub repository. Issues labeled by need reproduction will be closed if no activities in 3 days.
Describe the bug
We are developing a package that is used by our community with vitejs.
In our package.json we have a field browser
So all of these packages are NodeJs packages and we use them only if the code is running by NodeJS.
If code is running by browser, we don't want those packages to be at the final bundle as it increases bundle size.
Webpack respects this field, however, vitejs doesn't.
Is it possible to support this field or did I miss some additional configuration?
Even injected polyfill doesn't work well as it's kind of proxy and doesn't have named imports
original code
build code
an error
System Info
Used package manager:
yarn
The text was updated successfully, but these errors were encountered: