Skip to content

Commit

Permalink
fix(ewa-webpack): 修复因为路径中包含空格导致脚本执行报错的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
lyfeyaj committed Jul 6, 2021
1 parent 264cb9a commit 62c1e4f
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 9 deletions.
2 changes: 1 addition & 1 deletion packages/webpack/lib/run.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const WATCH_PATTERNS = [
module.exports = function(webpack) {
// nodemon 实例
const script = nodemon({
exec: `${webpack} --config ${CONFIG_FILE} --watch`,
exec: `${webpack} --config "${CONFIG_FILE}" --watch`,
watch: [FAKE_WATCH_DIR],
ext: 'js'
});
Expand Down
2 changes: 1 addition & 1 deletion packages/webpack/lib/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const NODE_ENV = process.env.NODE_ENV || 'development';
let webpackBin = require.resolve('webpack-cli');

// Support windows and *nix like os
webpackBin = `node ${webpackBin}`;
webpackBin = `node "${webpackBin}"`;

if (NODE_ENV === 'development') {
require('./run.dev')(webpackBin);
Expand Down
8 changes: 1 addition & 7 deletions packages/webpack/lib/run.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,7 @@ const execSync = require('child_process').execSync;
const configFile = path.resolve(__dirname, 'config.js');

module.exports = function(webpack) {
let cmd = [
webpack,
'--config',
configFile,
'--colors',
'--display=errors-only'
].join(' ');
let cmd = `${webpack} --config "${configFile}" --colors --display=errors-only`

execSync(cmd, {
env: process.env,
Expand Down

0 comments on commit 62c1e4f

Please sign in to comment.