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

require() triggers a warning if running in browser #880

Open
tacman opened this issue Oct 23, 2023 · 6 comments
Open

require() triggers a warning if running in browser #880

tacman opened this issue Oct 23, 2023 · 6 comments

Comments

@tacman
Copy link

tacman commented Oct 23, 2023

There is a warning in then console about the require function not being present when running twigjs as an imported module.

Please see symfony/symfony#52252

The code still works, but it would be nice to get rid of this warning.

@RobLoach
Copy link
Collaborator

RobLoach commented Nov 6, 2023

Looks like the loader could use some tweaks to have it function better with the browser:
https://github.com/twigjs/twig.js/blob/master/src/twig.loader.fs.js#L9

@tacman
Copy link
Author

tacman commented Nov 6, 2023

I used to have something in place when I used webpack to avoid the error, but I don't know if it will work with modules. What is fs, and is there a package on jsdelivr that can be used for it?

@willrowe
Copy link
Collaborator

willrowe commented Nov 7, 2023

In what context is the fs loader being used in the browser? Wouldn't you use a different loader in that case?

@tacman
Copy link
Author

tacman commented Nov 7, 2023 via email

@willrowe
Copy link
Collaborator

willrowe commented Nov 7, 2023

Interesting, so it happens just by importing without doing anything else?

@tacman
Copy link
Author

tacman commented Nov 7, 2023 via email

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

No branches or pull requests

3 participants