npm package Configure Prepare run scripts[配置执行脚本]
The final thing is to add three scripts entries into our package.json:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | { "scripts" : { "start" : "npm run serve | npm run dev" , "serve" : "./node_modules/.bin/http-server -p 8080" , "dev" : "webpack-dev-server --progress --colors --port 8090" }, "name" : "basic-property-grid" , "version" : "0.1.0" , "main" : "index.js" , "dependencies" : { "react" : "~0.11.2" }, "devDependencies" : { "webpack" : "~1.4.4" , "webpack-dev-server" : "~1.6.5" , "jsx-loader" : "~0.11.2" , "http-server" : "~0.7.1" } } |
What we just did was to add 3 commands that can be run through npm run <cmd>.
serve - npm run serve - just starts an http-server serving files from our local dir, running on port 8080 (it serves index.html).
dev - npm run dev - starts webpack-dev-server on port 8090 which serves both the webpack-dev-server.js runtime and our bundle.js file.
start - npm run start - command simply executes serve first and then starts the dev server.
Launch【运行】
Now we are ready:
1 | $ npm run start |
If everything is fine, you should open localhost:8080
版权声明
由 davidzhang创作并维护的 Gowhich博客采用创作共用保留署名-非商业-禁止演绎4.0国际许可证。
本文首发于
博客(
https://www.gowhich.com ),版权所有,侵权必究。
本文永久链接: https://www.gowhich.com/blog/694
版权声明
由 davidzhang创作并维护的 Gowhich博客采用创作共用保留署名-非商业-禁止演绎4.0国际许可证。
本文首发于 Gowhich博客( https://www.gowhich.com ),版权所有,侵权必究。
本文永久链接: https://www.gowhich.com/blog/694