diff --git a/docs/Configuration.md b/docs/Configuration.md index c0f9974cd..73295f25e 100644 --- a/docs/Configuration.md +++ b/docs/Configuration.md @@ -664,7 +664,7 @@ module.exports = { > **Note:** `entry`, `externals`, `output`, `watch`, and `stats` options will be ignored. For production builds, `devtool` will also be ignored. -> **Note:** `CommonsChunkPlugins`, `HtmlWebpackPlugin`, `UglifyJsPlugin`, `HotModuleReplacementPlugin` plugins will be ignored because Styleguidist already includes them or they may break Styleguidist. +> **Note:** `CommonsChunkPlugins`, `HtmlWebpackPlugin`, `MiniHtmlWebpackPlugin`, `UglifyJsPlugin`, `HotModuleReplacementPlugin` plugins will be ignored because Styleguidist already includes them or they may break Styleguidist. > **Note:** Run style guide in verbose mode to see the actual webpack config used by Styleguidist: `npx styleguidist server --verbose`. diff --git a/docs/Webpack.md b/docs/Webpack.md index 468ddc1ed..52873cbe8 100644 --- a/docs/Webpack.md +++ b/docs/Webpack.md @@ -43,7 +43,7 @@ module.exports = { > **Note:** `entry`, `externals`, `output`, `watch`, and `stats` options will be ignored. For production builds, `devtool` will also be ignored. -> **Note:** `CommonsChunkPlugins`, `HtmlWebpackPlugin`, `UglifyJsPlugin`, `HotModuleReplacementPlugin` plugins will be ignored because Styleguidist already includes them or they may break Styleguidist. +> **Note:** `CommonsChunkPlugins`, `HtmlWebpackPlugin`, `MiniHtmlWebpackPlugin`, `UglifyJsPlugin`, `HotModuleReplacementPlugin` plugins will be ignored because Styleguidist already includes them or they may break Styleguidist. > **Note:** If your loaders don’t work with Styleguidist try to make `include` and `exclude` absolute paths. @@ -81,7 +81,7 @@ module.exports = { > **Note:** `entry`, `externals`, `output`, `watch`, and `stats` options will be ignored. For production builds, `devtool` will also be ignored. -> **Note:** `CommonsChunkPlugins`, `HtmlWebpackPlugin`, `UglifyJsPlugin`, `HotModuleReplacementPlugin` plugins will be ignored because Styleguidist already includes them or they may break Styleguidist. +> **Note:** `CommonsChunkPlugins`, `HtmlWebpackPlugin`, `MiniHtmlWebpackPlugin`, `UglifyJsPlugin`, `HotModuleReplacementPlugin` plugins will be ignored because Styleguidist already includes them or they may break Styleguidist. ## Create React App diff --git a/scripts/utils/__tests__/mergeWebpackConfig.spec.js b/scripts/utils/__tests__/mergeWebpackConfig.spec.js index d66d4cc3e..95fc69534 100644 --- a/scripts/utils/__tests__/mergeWebpackConfig.spec.js +++ b/scripts/utils/__tests__/mergeWebpackConfig.spec.js @@ -2,6 +2,7 @@ import mergeWebpackConfig from '../mergeWebpackConfig'; class UglifyJsPlugin {} class MyPlugin {} +class MiniHtmlWebpackPlugin {} it('should merge two objects', () => { const result = mergeWebpackConfig({ a: 0, b: 0 }, { b: 1 }); @@ -26,15 +27,18 @@ it('should ignore certain sections', () => { }); it('should ignore certain Webpack plugins', () => { + const baseInstance = new UglifyJsPlugin(); + const userInstance = new UglifyJsPlugin(); const result = mergeWebpackConfig( { - plugins: [new UglifyJsPlugin()], + plugins: [baseInstance], }, { - plugins: [new UglifyJsPlugin(), new MyPlugin()], + plugins: [userInstance, new MyPlugin(), new MiniHtmlWebpackPlugin()], } ); expect(result.plugins).toHaveLength(2); + expect(result.plugins[0]).toBe(baseInstance); expect(result.plugins[0].constructor.name).toBe('UglifyJsPlugin'); expect(result.plugins[1].constructor.name).toBe('MyPlugin'); }); diff --git a/scripts/utils/mergeWebpackConfig.js b/scripts/utils/mergeWebpackConfig.js index 641f08500..46fcfb8bd 100644 --- a/scripts/utils/mergeWebpackConfig.js +++ b/scripts/utils/mergeWebpackConfig.js @@ -12,6 +12,7 @@ const IGNORE_SECTIONS_ENV = { const IGNORE_PLUGINS = [ 'CommonsChunkPlugins', + 'MiniHtmlWebpackPlugin', 'HtmlWebpackPlugin', 'OccurrenceOrderPlugin', 'DedupePlugin',