pack2box3
v1.0.2
Published
打包在本地编写的box3代码并输出到一个文件中
Downloads
7
Readme
Pack 2 Box3
将本地js代码打包成一个文件供box3运行!
安装
- 全局安装
$ npm install -g pack2box3
- 在项目中安装
并在$ npm install pack2box3
package.json
下增加一下内容"scripts":{ "build":"pack2box3 pack ./main.js ./out.bundle.js" }
使用方法
pack2box3 <入口文件> <输出文件> [js种类]
js种类可以分为module
和commonjs
两种, 应该看名字就知道是啥了
示例
// main.js
import sayHello from "./sayHello";
sayHello();
// sayHello.js
export default sayHello()
function sayHello() {
return sayHello = () => {
console.log('Hello!');
};
}
打包
$ pack2box3 main.js out.bundle.js
out.bundle.js复制到box3里面并运行,可以看到控制台输出 Hello!