简体   繁体   English

webpack和lite-server进行反应

[英]webpack and lite-server for react

I built my own webpack.config.js for react development, also I use lite-server. 我构建了自己的webpack.config.js进行响应开发,也使用lite-server。 Is it possible to put both webpack and lite-server commands to package.json like that: 是否可以像这样将webpacklite-server命令都webpack package.json中:

"scripts": {
  "dev": "lite-server webpack"
}

or are there any other ways to do that? 还是有其他方法可以做到这一点?

If you want to run 2 commands sequential from package.json script you can use "anding" like this: 如果要从package.json脚本顺序运行2个命令,则可以使用“ anding”,如下所示:

"scripts": {
  "dev": "lite-server && webpack"
}

It first runs command lite-server followed by run of webpack if lite-server did not fail. 如果lite-server没有失败,它将首先运行lite-server命令,然后运行webpack

For concurrent execution I would recommend https://www.npmjs.com/package/concurrently package. 对于并发执行,我建议使用https://www.npmjs.com/package/concurrently软件包。

There is also https://www.npmjs.com/package/npm-run-all but I have not tested it myself. 也有https://www.npmjs.com/package/npm-run-all,但我自己尚未对其进行测试。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM