我正在尝试使用Browserify,我在项目目录中有以下文件:
- node_models/.bin - where browserify is located
sample.js
module.exports = 'Hello, world';
index.js
window.alert(require('./sample'));
有谁能帮我学习如何使用browserify运行它?我正在使用Windows操作系统。
我正在尝试使用Browserify,我在项目目录中有以下文件:
sample.js
module.exports = 'Hello, world';
index.js
window.alert(require('./sample'));
有谁能帮我学习如何使用browserify运行它?我正在使用Windows操作系统。
node_modules\.bin\browserify index.js > bundle.js
然而,你可以通过在 package.json
中的 scripts
下添加一个条目来使事情更加方便:
{
...
"scripts": {
"bundle": "browserify index.js > bundle.js"
}
}
您可以使用以下命令构建捆绑包:
npm run bundle
node --version
和browserify --version
。 - cartant