From 1c71c4b72d9ffab7dff89c777dfa970159b5a779 Mon Sep 17 00:00:00 2001 From: "a.stambultsian" Date: Wed, 29 Jan 2020 18:17:38 +0300 Subject: [PATCH] fixed react-styleguidist --- package.json | 1 + styleguide/config.js | 11 +++++++++++ webpack.config.js | 2 +- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index fc992d382d..dc104d9276 100644 --- a/package.json +++ b/package.json @@ -37,6 +37,7 @@ "autoprefixer": "^7.2.3", "babel-loader": "^8.0.4", "classnames": "^2.2.6", + "clean-webpack-plugin": "^3.0.0", "concurrently": "^4.1.2", "css-loader": "^3.2.0", "eslint": "~6.8.0", diff --git a/styleguide/config.js b/styleguide/config.js index 7b701f5fb7..0901d6c24d 100644 --- a/styleguide/config.js +++ b/styleguide/config.js @@ -3,6 +3,7 @@ const webpackConfig = require('../webpack.config'); const merge = require('webpack-merge'); const MiniCssExtractPlugin = require('mini-css-extract-plugin'); const postcssConfig = require('../postcss.config'); +const { CleanWebpackPlugin } = require('clean-webpack-plugin'); module.exports = { title: 'VKUI styleguide', @@ -162,6 +163,16 @@ module.exports = { return require('react-docgen').parse(source, resolver, handlers, { filename: filePath }) } }, + dangerouslyUpdateWebpackConfig(webpackConfig) { // запрещаем вычищать .git + webpackConfig.plugins = webpackConfig.plugins.reduce((acc, item) => { + if (item instanceof CleanWebpackPlugin) { + item.cleanOnceBeforeBuildPatterns = ['**/*', '!.git']; + } + acc.push(item); + return acc; + }, []) + return webpackConfig; + }, webpackConfig: merge(webpackConfig, { module: { rules: [{ diff --git a/webpack.config.js b/webpack.config.js index 0c5cc3a199..f6acc9e7ed 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -51,7 +51,7 @@ const config = { 'react-dom': 'react-dom' }, /@vkontakte\/icons/i - ] + ], }; const devConfig = {