-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
fix: correct minimum node version to one that supports modules #1085
Conversation
The current published project is type "commonjs" and not type "module" and that is seen at the package.json here https://www.npmjs.com/package/snabbdom?activeTab=code Maybe the published Snabbdom sources have type "module" removed from them, I don't know... |
@mreinstein , why was there 12.18? #1080 (comment) |
It depends on how one defines support. technically it will work in node > 12.0, but that requires a command line flag. 12.17 and up work without the command line flag. |
That's because the last publish to npm was over a year ago, but the commit that introduced So this PR will ensure that the node version matches the absolute minimum required value. It's questionable if maybe this should actually be 12.17.0 as kuraga pointed out. |
I have experience using type module with node v12 and modules do work there |
note: if dependents use other files than the main exported file, those other files must be explicitly exported at the package.json. Should exports for these files be added to the package.json?
|
Out of scope for this PR, I want to keep this focused on fixing one singular problem. |
This comment was marked as off-topic.
This comment was marked as off-topic.
@jvanbruegge note that the next snabbdom |
The minimum Node version is a bit artificial as Snabbdom is a browser library and doesn't work in Node. That being said if a version of Node can't import Snabbdom then it certainly doesn't support Snabbdom, so bumping the version seems reasonable. I do wonder though if removing the "engine" entry altogether would have any ramifications? It was added in #948. |
You have to be careful with assumptions. Server side rendering is one case where snabbdom might be invoked outside of a browser. The only parts of snabbdom that actually interface with the browser are neatly encapsulated in
Can you explain why there is a hesitancy around bumping the node version up to |
Those are very good points 👍. I didn't think about server-side rendering – proving that you're absolutely right about not making too many assumptions. Thanks for the PR.
It also serves as info that web bundlers can use. Webpack, for instance, uses that field to determine which module format to use. |
Currently our
package.json
says minimum node engine version is8
, but we have"type": "module"
in ourpackage.json
and that requires node v12+ as per https://nodejs.org/dist/latest-v20.x/docs/api/esm.html#modules-ecmascript-modules