-
-
Notifications
You must be signed in to change notification settings - Fork 44
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
call createRequire lazily #63
Comments
I'm sorry, I can't tell from your description what it is you're trying to do and how such a change would help. Can you explain in more detail? |
I guess the problem could be solved if you just don't call the That is why i'm suggesting a simple wrapper function that calls |
think this code works fine: // create require lazily to fix jspm
// eslint-disable-next-line func-style
let require = pkg => {
require = createRequire(import.meta.url);
return require(pkg);
}; |
I’m still having trouble understanding why you’d want to do such a thing. What’s the use case? It also seems like this is a bug in JSPM? |
yea, it's a bug with jspm... my simple usecase is that i would like to import eslint in the browser using a cdn+import, this is the only bit that prevents me from being able to load eslint@8 from jspm eslint@7 did not have any createRequire stuff |
Is there an open issue on jspm about supporting createRequire? |
created one 2 days ago: jspm/babel-plugin-transform-cjs-dew#15 |
We don’t intend to support loading the eslint package directly in the browser like this. Your best bet is to get jspm to fix the bug. |
I have some success to load eslint using
import('https://jspm.dev/eslint@7')
and running it too without any eslint config file in the browser. (I'm usinguseEslintrc: false
)version 8 don't work as grate, think it boils down to this:
eslintrc/lib/config-array-factory.js
Line 57 in 731fa49
...and also the fact that jspm don't support dynamic
require()
very well...the best thing would be to not use
createRequire
at all and... they should be loaded async withimport()
instead... but lets not be hanged up on this too much... cuz it require to much refactoring and breakage.I think the quickest and easiest solution would be to do:
is this 👆 something you could quickly impl?
currently
import('https://jspm.dev/eslint@7')
dose not call anyrequire()
.i still have yet to figure out how to manually add some eslint plugin without using the rules config that are limited to plain objects.
The text was updated successfully, but these errors were encountered: