Using CLI to Change npm package.json "type" to "module"/"commonjs"
Very short one today.
You can use the built-in npm pkg command to modify the type field in your package.json directly via the command line.
Here's how:
Set type to "module"
npm pkg set type=module
Change back to "commonjs" or another value
npm pkg set type=commonjs
Remove the type field entirely
npm pkg delete type
Handy, right?
