-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add a watch mode to standard command set, uses production configuration and the Dev server watch polling options * Add Watch to check-configuration * Update a couple vulnerabilities
- Loading branch information
Showing
8 changed files
with
98 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,31 @@ | ||
module.exports = (environment) => { | ||
const { | ||
scripts: { useJsxSyntax }, | ||
sourceMaps | ||
} = environment; | ||
const { | ||
scripts: { useJsxSyntax }, | ||
sourceMaps | ||
} = environment; | ||
|
||
let presets = [ | ||
[ | ||
'@babel/preset-env', | ||
{ | ||
targets: { | ||
esmodules: true | ||
} | ||
} | ||
] | ||
]; | ||
let presets = [ | ||
[ | ||
'@babel/preset-env', | ||
{ | ||
targets: { | ||
esmodules: true | ||
} | ||
} | ||
] | ||
]; | ||
|
||
if (useJsxSyntax) { | ||
presets = presets.concat(['@babel/preset-react']); | ||
} | ||
if (useJsxSyntax) { | ||
presets = presets.concat(['@babel/preset-react']); | ||
} | ||
|
||
return [ | ||
{ | ||
loader: 'babel-loader', | ||
options: { | ||
presets: presets, | ||
sourceMaps: sourceMaps | ||
} | ||
} | ||
]; | ||
} | ||
return [ | ||
{ | ||
loader: 'babel-loader', | ||
options: { | ||
presets: presets, | ||
sourceMaps: sourceMaps | ||
} | ||
} | ||
]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
const chalk = require('chalk'); | ||
const webpack = require('webpack'); | ||
|
||
/** | ||
* Start the watch process for Webpack | ||
*/ | ||
module.exports = function watchWebpack(config, watchOptions) { | ||
try { | ||
const { poll = 1000, aggregateTimeout = 600 } = watchOptions; | ||
const compiler = webpack(config); | ||
console.log(chalk.yellow('Start watch process...')); | ||
console.log(''); | ||
|
||
const watching = compiler.watch({ poll: poll, aggregateTimeout: aggregateTimeout }, (err, stats) => { | ||
if (err) { | ||
console.error(err); | ||
return; | ||
} | ||
|
||
console.log(stats.toString({ | ||
colors: true | ||
})); | ||
}); | ||
|
||
process.on('SIGINT', () => { | ||
watching.close(() => { | ||
console.log('Watching stopped.'); | ||
process.exit(0); | ||
}); | ||
}); | ||
} | ||
catch (error) { | ||
console.error(chalk.red('Build failed...')) | ||
console.error(error); | ||
} | ||
} |