Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
454 views
in Technique[技术] by (71.8m points)

在electron+react+webpack项目中为什么package.json中的script这样子写不会按预想的结果执行?

没有修改之前的代码是这样的,但是启动的时候需要两个命令行窗口,于是就想要改一下命令但是不能够按照预想的结果执行,只会执行第一个命令
第一种方案需要执行以下两个命令并且需要打开两个命令窗口

  1. npm run watch

  2. npm start

"scripts": {
    "test": "npm test",
    "start": "./node_modules/electron-prebuilt/dist/Electron.app/Contents/MacOS/Electron .",
    "watch": "./node_modules/.bin/webpack-dev-server",
    "electron-rebuild": "./node_modules/.bin/electron-rebuild"
  },

修改之后的代码,我想要只需要在一个命令窗口执行一句话 npm start就能够执行

"scripts": {
    "test": "npm test",
    "start": "./node_modules/.bin/webpack-dev-server && ./node_modules/electron-prebuilt/dist/Electron.app/Contents/MacOS/Electron .",
    "electron-rebuild": "./node_modules/.bin/electron-rebuild"
  },

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...