From 78fa12ac9d270113903b1c119386452ef35d50d7 Mon Sep 17 00:00:00 2001 From: Ricardo Gobbo de Souza Date: Thu, 27 Jun 2019 20:02:44 -0300 Subject: [PATCH] feat: watch config file --- lib/module.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lib/module.js b/lib/module.js index dac9a1f..7c44221 100644 --- a/lib/module.js +++ b/lib/module.js @@ -1,3 +1,4 @@ +const { resolve } = require('path') const StyleLintPlugin = require('stylelint-webpack-plugin') const logger = require('./logger') const { moduleExists } = require('./utils') @@ -16,6 +17,19 @@ module.exports = function (moduleOptions) { ...moduleOptions } + const filesToWatch = [ + '.stylelintrc', + '.stylelintrc.json', + '.stylelintrc.yaml', + '.stylelintrc.yml', + '.stylelintrc.js', + 'stylelint.config.js' + ] + + this.options.watch.push( + ...filesToWatch.map(file => resolve(this.options.rootDir, file)) + ) + this.extendBuild((config, { isDev }) => { if (isDev) { config.plugins.push(new StyleLintPlugin(options))