From 3e15e5873fee6aa806f99ac7bed4699b110f7cec Mon Sep 17 00:00:00 2001 From: Bouillaguet Quentin Date: Thu, 27 Jul 2023 11:04:00 +0200 Subject: [PATCH] fix(webpack): Ignore fs import on copc dependency Ignoring fs for all modules led to problems with eslint (which depends on fs). --- webpack.config.js | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/webpack.config.js b/webpack.config.js index af75664c3d..ce5b1b8ea1 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,5 +1,6 @@ const fs = require('fs'); const path = require('path'); +const webpack = require('webpack'); const ESLintPlugin = require('eslint-webpack-plugin'); const mode = process.env.NODE_ENV; @@ -45,9 +46,6 @@ module.exports = () => { context: path.resolve(__dirname), resolve: { modules: [path.resolve(__dirname, 'src'), 'node_modules'], - alias: { - 'fs': false, - }, }, entry: { itowns: [ @@ -83,9 +81,17 @@ module.exports = () => { }, ], }, - plugins: [new ESLintPlugin({ - files: include, - })], + plugins: [ + new ESLintPlugin({ + files: include, + }), + // Prevent the generation of module fs for import on copc dependency + // See https://webpack.js.org/plugins/ignore-plugin/ + new webpack.IgnorePlugin({ + resourceRegExp: /^fs$/, + contextRegExp: /copc/, + }), + ], devServer: { devMiddleware: { publicPath: '/dist/',