[英]How to copy package.json to dist folder without the scripts part
I'm using webpack to bundle my javascript library and I'm currently copying the package.json
to the dist folder using CopyWebpackPlugin .
(...)
plugins: [
new CopyPlugin({
patterns: [{
from: "package.json",
to: "dist"
}],
})
],
(...)
我想知道是否可以在没有脚本标签的情况下复制package.json
:
{
"name": "monaco-javascript-compiler",
"version": (...),
"description": "(...)",
"main": (...),
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"debug": "npx webpack --config webpack.config.js --mode=development",
"build": "npx webpack --config webpack.config.js --mode=production"
},
"repository": {
"type": "git",
"url": "git+https://github.com/RicardoGomesRocha/monaco-javascript-compiler.git"
},
"author": "Ricardo Rocha",
"dependencies": {(...)},
"devDependencies": {(...)}
}
I know a solution that involves using gulp to read the package.json
, remove the script tag from the JSON and output a new file with that JSON, but I'm trying to avoid that.
CopyWebpackPlugin
中有一个名为transform
的选项,它允许您在将文件复制到 dist 文件夹之前修改文件的内容。
在此处查看文档: CopyWebpackPlugin
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.