React 组件打包发布指南
指南
package.json 配置
自定义 package.json 文件如下所示:
{
"name": "npm-webpack-react-module", // npm 发布名称
"version": "1.0.2", // 版本号
"main": "dist/index.js", // 打包后的入口文件
"scripts": {
"test": "echo "Error: no test specified" && exit 1",
"start": "webpack-dev-server --mode development",
"transpile": "babel src -d dist --copy-files",
"prepublishOnly": "npm run transpile"
}
}
打包步骤
- 执行
npm run transpile
命令进行编译 - 发布到 npm:
npm publish
6.48KB
文件大小:
评论区