From d55dc37293c5bc8b2a597e7b57b81bf5bfe4214b Mon Sep 17 00:00:00 2001 From: Laetitia Fesselier Date: Fri, 11 Nov 2022 13:33:00 -0500 Subject: [PATCH] [ESLint] Disable on prod instances --- webpack.config.js | 93 ++++++++++++++++++++++++----------------------- 1 file changed, 48 insertions(+), 45 deletions(-) diff --git a/webpack.config.js b/webpack.config.js index 026ea956d21..0c822220a00 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -157,6 +157,53 @@ function lorisModule(mname, entries, override=false) { }; } +const plugins = [ + new CopyPlugin({ + patterns: [ + { + from: path.resolve(__dirname, 'node_modules/react/umd'), + to: path.resolve(__dirname, 'htdocs/vendor/js/react'), + force: true, + globOptions: { + ignore: ['react.profiling.min.js'], + }, + filter: async (path) => { + const file = path.split('\\').pop().split('/').pop(); + const keep = [ + 'react.development.js', + 'react.production.min.js', + ]; + return keep.includes(file); + }, + }, + { + from: path.resolve(__dirname, 'node_modules/react-dom/umd'), + to: path.resolve(__dirname, 'htdocs/vendor/js/react'), + force: true, + filter: async (path) => { + const file = path.split('\\').pop().split('/').pop(); + const keep = [ + 'react-dom.development.js', + 'react-dom.production.min.js', + ]; + return keep.includes(file); + }, + }, + ], + }), +]; + +mode == 'development' && plugins.push(new ESLintPlugin({ + files: [ + 'modules/', + 'jsx/', + 'jslib/', + 'htdocs/js/', + 'webpack.config.js', + ], + cache: true, +})); + let config = [ // Core components { @@ -182,51 +229,7 @@ let config = [ 'react-dom': 'ReactDOM', }, devtool: 'source-map', - plugins: [ - new ESLintPlugin({ - files: [ - 'modules/', - 'jsx/', - 'jslib/', - 'htdocs/js/', - 'webpack.config.js', - ], - cache: true, - }), - new CopyPlugin({ - patterns: [ - { - from: path.resolve(__dirname, 'node_modules/react/umd'), - to: path.resolve(__dirname, 'htdocs/vendor/js/react'), - force: true, - globOptions: { - ignore: ['react.profiling.min.js'], - }, - filter: async (path) => { - const file = path.split('\\').pop().split('/').pop(); - const keep = [ - 'react.development.js', - 'react.production.min.js', - ]; - return keep.includes(file); - }, - }, - { - from: path.resolve(__dirname, 'node_modules/react-dom/umd'), - to: path.resolve(__dirname, 'htdocs/vendor/js/react'), - force: true, - filter: async (path) => { - const file = path.split('\\').pop().split('/').pop(); - const keep = [ - 'react-dom.development.js', - 'react-dom.production.min.js', - ]; - return keep.includes(file); - }, - }, - ], - }), - ], + plugins: plugins, optimization: optimization, resolve: resolve, module: mod,