I have created an npm package and when we run it using npx
it outputs the result but also give this error before printing output:
ExperimentalWarning: Importing JSON modules is an experimental feature and might change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
Why this is happening? Tried on different system and OS, even run with --trace-warning
:
npx xkeshav --trace-warnings
Note the package has these things in it:
src/index.js
:
#!/usr/bin/env node
import boxen from "boxen";
import chalk from "chalk";
const boxenOptions = {
padding: 1,
width: 80
};
const intro = chalk.bold(
"Hi, Keshav Mohta here ????nnI'm a web developer from India.n"
);
const links = [ { some: 'link'} ];
const linkMap = links.map(({name, url}) => `${name} -> ${chalk.italic(url)}`).join("nn");
const linkList = "nnFind me on the internet:nn" + linkMap;
console.log(boxen(intro + linkList, boxenOptions));
and relevant part of package.json
as below:
{
"main": "src/index.js",
"bin": {
"xkeshav": "src/index.js"
},
"scripts": {
},
"files": [
"**/*.js"
],
"dependencies": {
"boxen": "^8.0.0"
},
}
5