A simple tool to set the type to module in package.json files.
You can install npm-module-type globally to use it as a command-line tool:
npm install -g npm-module-typeNavigate to your Node.js project directory containing the package.json file and run the following command:
npm-module-typeThis command will update the package.json file in the current directory, setting "type": "module".
Assume you have a package.json file like this:
{
"name": "my-node-project",
"version": "1.0.0",
"description": "A sample Node.js project",
"main": "index.js",
"scripts": {
"start": "node index.js"
},
"author": "Your Name",
"license": "MIT"
}to
{
"name": "my-node-project",
"version": "1.0.0",
"description": "A sample Node.js project",
"main": "index.js",
"scripts": {
"start": "node index.js"
},
"author": "Your Name",
"license": "MIT",
"type": "module"
}