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

not able to externalize fs library which is being imported in another library as require('fs') #6

Open
Hari-sankoju opened this issue Mar 31, 2024 · 0 comments

Comments

@Hari-sankoju
Copy link

Summary

Hi @davidmyersdev ,
As per my understanding this plugin actually helps make the vite react applications for externalizing the dependencies.
My application is using jsPDF library, which is using fs library and importing as require('fs'). but vite is giving 'require is not a function'.
So I tried to use vite-plugin-externalize-deps to make fs module externalize as below in vite.config.mjs file
but it is not working. pls help me on this.

  1. added as dev dependency
  2. below is the content of vite.config.mjs
    import { externalizeDeps } from 'vite-plugin-externalize-deps'

plugins: [react(),
externalizeDeps({
include: [
'fs'
],})

Please let me know if I am doing anything wrong.

I also tried node polyfils and other things but nothing working. Please help me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant