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

Make this package browser friendly #132

Open
barak007 opened this issue Apr 13, 2022 · 2 comments
Open

Make this package browser friendly #132

barak007 opened this issue Apr 13, 2022 · 2 comments

Comments

@barak007
Copy link

barak007 commented Apr 13, 2022

Hello we have a use case that we want to use this plugin in the browser and bundle it via webpack.
Currently the FileSystemLoader is being use as a fallback loader if no load provided via the config, and it is always imported by the package index.

The issue is:
FileSystemLoader imports nodejs fs module and that's not browser friendly (needs config in order to bundle).

I have few suggestions for solutions to this issue:

  1. Add "browser" field to the package.json that will implement a "loader" that throws something like "when using this package in browser you must provide a custom loader"
  2. Create entrypoint specifically for browser usage which does not import FileSystemLoader by default
  3. Allow inject the fs module to the loaders avoiding importing it directly (split the index into a factory that will accept fs)

These are non-breaking changes that can be done here.

We are willing to make this PR.

Please advice.

@barak007
Copy link
Author

same is true for saveJSON

@GideonMax
Copy link

you can make an alias for fs through webpack to some file that does nothing

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

2 participants