-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
compat: xregexp doesn't work in compat mode #13424
Comments
// test.js
// @deno-types='./node_modules/xregexp/types/index.d.ts'
import XRegExp from './node_modules/xregexp/src/index.js' // package.json
{
"type": "module",
"dependencies": {
"xregexp": "^5.1.0"
}
}
|
@bartlomieju Bear with me if I am stating the obvious, but maybe this could be helpful:
Let me know, if I can help with anything :-) |
@cfjello right, so this is the crux of the problem - since these files are CJS (because of |
Current state:
It seems something is still of - there's |
@lucacasonato @bartlomieju
I just did the test based on:
importTest.js file is:
The source index.js file looks like this:
And the package.json file includes the line:
I tried different combinations, renaming the test file to importTest.mjs or setting "type": "module" in my own package.json, or fetching the index.js from /src/index.js instead of /lib. but I get various missing module, no default export errors.
I am not an expert in ESM, but as stated earlier, the code is pretty much vanilla JavaScript and I know what to change to make it work. in the Deno environment.
I do not know the specifics of how Node do or do not support 'magic resolution of imports' for ESM and/or vanilla JavaScript, but keep in mind, that this is working code using 'import' within the Nodejs environment with 7,890,538 million weekly downloads.
Originally posted by @cfjello in #2506 (comment)
The text was updated successfully, but these errors were encountered: