Skip to content

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

@Hari-sankoju

Description

@Hari-sankoju

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions