[英]How to add a dot in the package.json file using npm-pkg command?
I want to use the npm pkg set command to generate a package.json file like this:我想使用npm pkg set 命令生成一个 package.json 文件,如下所示:
{
...
"exports": {
".": {
"import": "./dist/my-lib.js",
"require": "./dist/my-lib.umd.cjs"
}
}
...
}
But I'm not able to add the "."但我无法添加“。” key
钥匙
I tried running npm pkg set exports..import=./dist/my-lib.js
and npm pkg set exports.\.import=./dist/my-lib.js
我尝试运行
npm pkg set exports..import=./dist/my-lib.js
和npm pkg set exports.\.import=./dist/my-lib.js
You can set a property directly in json format:您可以直接以 json 格式设置属性:
npm pkg set export='{".":{"import": "./dist/my-lib.js","require": "./dist/my-lib.umd.cjs"}}' --json
Please note that this will overwrite existing "export" property.请注意,这将覆盖现有的“导出”属性。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.