-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Support Vite bundler better #1477
Comments
Actually I figure it out without need to change the file extension. This happens because First, I need to add files with
Add these extensions to resolve:
Then inside
When I serve up the web app, I will get this error message:
So my web app's index.html, I need to add:
Now the serve command is working. However, the build command still does not work with the same error. I created a rollup plugin:
Then add this plugin to the vite config:
Now build command should work. Another issue I notice:
In vite.config.ts, add:
The final vite.config.ts:
|
Dude I love you! thanks for this! |
I'm not familiar with vite, is there anything we could do in our library to make this more seamless? |
Indeed @johnf - I could even test any alpha releases against our production Vite setup and would be happy to make a PR to do so |
Thanks a ton for the config, this was super helpful! If anyone faces this same issue with expo vector icons (which is built on top of react-native-vector-icons), you can get the above config working with minimal changes:
build: {
commonjsOptions: { transformMixedEsModules: true },
rollupOptions: {
plugins: [
rollupPlugin([/react-native-vector-icons/, /@expo\/vector-icons/]),
],
},
}, |
Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
I'm attempting to use this package with Vite to bundle a React Native Web project. On doing so, it's been quite a challenge to use the
.js
files with.jsx
syntax, as Vite likes the throw the following errors:Describe the solution you'd like
A clear and concise description of what you want to happen.
While there might be a way to migrate around this, I've spent some time with it and haven't made much headway. The official Vite team themselves suggests moving
.js
files to.jsx
to side-step detection frustrations in doing this.Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
I could use
patch-package
, and likely may do this in the interim, but this wouldn't be much help in the long run.Additional context
Add any other context or screenshots about the feature request here.
I'm happy to make a PR renaming files to
.jsx
and fixing any related packaging errors that might arise from this.The text was updated successfully, but these errors were encountered: