-
Notifications
You must be signed in to change notification settings - Fork 984
feat: switch to explicit type: module
#1407
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
Conversation
c5e9aec to
39fc86f
Compare
|
This shouldn't be necessary because we have |
In regard to "newer, more flexible mechanism", I think you are thinking of the There are no warnings showing up; it is merely for best practices. |
No, I'm not, that one is even older.
In that case the resolution already picks up the correct export. |
|
As per
Basically, if you have a single format, you use |
That is an alternative to main, not an alternative to type. type is still, as per the quotation in the OP, still recommended. |
|
It's both because As I said, It doesn't make sense to add |
|
I appreciate the contribution, but I don't think this particular change is worth it. That said, I'd be happy to accept a trimmed-down PR with just the CommonJS->ESM changes in our scripts, as that makes simplifies importing test helpers in browser and Node. |
|
It turns out I was mistaken. There are warnings that show up. When I run the tests or binary files as imports I get this:
|
|
If I convert all the new ESM files to .mjs files, there shouldn't be any more warnings, however. |
This is simply not happening in this package. Client code imports the The warning you quote happens because you changed this file to be ESM. It's not an issue in the current code.
We have a package lock at the top level. I don't see any reason to add locks to the individual packages. Changing our sources and build system to ESM might be a good idea, but that can be done without changing anything about the way the distributed code works. Similarly, we could use ESM for our utility scripts and use A big PR like this that conflates a bunch of issues and makes unrelated changes is not something that's welcome, sorry. |
feat: switch to explicit
type: moduleortype: commonjsThis is recommended because Node states:
This necessitated supplying
type: commonjstodistdirectories so that imports wouldn't now err, and so that older browsers wouldn't break with a.cjsextension content type issue or with consumers needing to update changed paths.Also:
engines) and in test files; I kept the benchmark package as commonjs in case you wanted to allow benchmarking in older browserspackage-lock.jsonfiles (they are not excluded from version control)I noticed that if the Unicode regular expression script is run, more scripts will be added, but I did not include that here, as it appears
acorn/src/unicode-property-data.jsstill needs updating.