This is just a memo about how to refer dependencies written in package.json
from JavaScript code.
import pkg from './package.json';
const dependencies = Object.keys(pkg.dependencies);
const devDependencies = Object.keys(pkg.devDependencies);
const peerDependencies = Object.keys(pkg.peerDependencies);
It would be useful in case of specifying externals
in rollup.config.js
.
{
external: Object.keys(pkg.dependencies)
...
}
Top comments (0)