Skip to content

Commit

Permalink
fix(webpack): Ignore fs import on copc dependency
Browse files Browse the repository at this point in the history
Ignoring fs for all modules led to problems with eslint (which depends
on fs).
  • Loading branch information
Desplandis committed Jul 27, 2023
1 parent f693a91 commit 3e15e58
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -45,9 +46,6 @@ module.exports = () => {
context: path.resolve(__dirname),
resolve: {
modules: [path.resolve(__dirname, 'src'), 'node_modules'],
alias: {
'fs': false,
},
},
entry: {
itowns: [
Expand Down Expand Up @@ -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/',
Expand Down

0 comments on commit 3e15e58

Please sign in to comment.