Skip to content

Commit

Permalink
Fix: Ignore mini-html-webpack-plugin (styleguidist#938)
Browse files Browse the repository at this point in the history
  • Loading branch information
okonet authored and sapegin committed Apr 18, 2018
1 parent 1d4828a commit bd70102
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion docs/Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down
4 changes: 2 additions & 2 deletions docs/Webpack.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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

Expand Down
8 changes: 6 additions & 2 deletions scripts/utils/__tests__/mergeWebpackConfig.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
Expand All @@ -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');
});
Expand Down
1 change: 1 addition & 0 deletions scripts/utils/mergeWebpackConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const IGNORE_SECTIONS_ENV = {

const IGNORE_PLUGINS = [
'CommonsChunkPlugins',
'MiniHtmlWebpackPlugin',
'HtmlWebpackPlugin',
'OccurrenceOrderPlugin',
'DedupePlugin',
Expand Down

0 comments on commit bd70102

Please sign in to comment.