Replies: 3 comments 1 reply
-
It not work with Os 64 bit? |
Beta Was this translation helpful? Give feedback.
0 replies
-
We can use https://tsup.egoist.sh/ to output this in both esm and cjs. I can do a PR if you're interested |
Beta Was this translation helpful? Give feedback.
0 replies
-
imo: ESM is the way to go. switched to ESM a year ago and haven't looked back. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
A maintainer proposed to switch to ES Modules for next major release. Since I also think it is a good to promote changes when they are going into the good direction, I tend to switch to ES Modules too.
What are ES Modules
ES Modules is the ECMAScript standard for working with modules. For more details, you can read this article.
What will be the impacts?
In your code, it will mean replacing
const nodeWifi = require('node-wifi')
byimport nodeWifi from 'node-wifi'
or maybeimport { scanWifi } from 'node-wifi'
.If you are using the library
node-wifi
in a commonJs code or library, you will need to change your code to use ES Modules.If you are already using the ES Module for your own code, you won't have to change anything.
Why (only) ES Modules?
Node.js was previously the standard CommonJS. But in opposite of CommonJS, ES Modules are used by all other js environments like browsers.
Node.js supports ES Modules since [version 12.x[(https://nodejs.org/docs/latest-v12.x/api/esm.html). Previous Node.js version which was not supporting ES Modules (Version 10.x) is no more supported by Node.js community (even security support). So I think it is the good timing to consider Node.js version 10.x as deprecated and so everybody should be able to use ES Modules.
An option would have been to support and export ES Modules in addition of current CommonJS modules. But so far several reasons incitate to keep only ES Modules:
For more details about choices, you can read this thread from a famous developer and packages maintainer.
What is your own opinion? Do not hesitate to discuss and give your point of view.
PS: thanks to @jimmywarting for his proposal
Beta Was this translation helpful? Give feedback.
All reactions