mirror of
https://github.com/facebook/docusaurus.git
synced 2025-04-29 18:27:56 +02:00
fix(v2): do not force terminate building if client bundle failed in development mode (#2437)
This commit is contained in:
parent
feaa75c876
commit
b3d14816bb
1 changed files with 24 additions and 20 deletions
|
@ -17,6 +17,7 @@ import LogPlugin from './plugins/LogPlugin';
|
||||||
|
|
||||||
export function createClientConfig(props: Props): Configuration {
|
export function createClientConfig(props: Props): Configuration {
|
||||||
const isProd = process.env.NODE_ENV === 'production';
|
const isProd = process.env.NODE_ENV === 'production';
|
||||||
|
const isBuilding = process.argv[2] === 'build';
|
||||||
const config = createBaseConfig(props, false);
|
const config = createBaseConfig(props, false);
|
||||||
|
|
||||||
const clientConfig = merge(config, {
|
const clientConfig = merge(config, {
|
||||||
|
@ -32,8 +33,17 @@ export function createClientConfig(props: Props): Configuration {
|
||||||
runtimeChunk: true,
|
runtimeChunk: true,
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
// Plugin to force terminate building if errors happened in the client bundle
|
new ChunkAssetPlugin(),
|
||||||
{
|
// Show compilation progress bar and build time.
|
||||||
|
new LogPlugin({
|
||||||
|
name: 'Client',
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
});
|
||||||
|
|
||||||
|
// When building include the plugin to force terminate building if errors happened in the client bundle.
|
||||||
|
if (isBuilding) {
|
||||||
|
clientConfig.plugins!.push({
|
||||||
apply: compiler => {
|
apply: compiler => {
|
||||||
compiler.hooks.done.tap('client:done', stats => {
|
compiler.hooks.done.tap('client:done', stats => {
|
||||||
if (stats.hasErrors()) {
|
if (stats.hasErrors()) {
|
||||||
|
@ -51,14 +61,8 @@ export function createClientConfig(props: Props): Configuration {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
},
|
|
||||||
new ChunkAssetPlugin(),
|
|
||||||
// Show compilation progress bar and build time.
|
|
||||||
new LogPlugin({
|
|
||||||
name: 'Client',
|
|
||||||
}),
|
|
||||||
],
|
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
return clientConfig;
|
return clientConfig;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue