Skip to content

Commit

Permalink
fix: do not polyfill available in browser Node modules
Browse files Browse the repository at this point in the history
Signed-off-by: Grigorii Shartsev <grigorii.shartsev@nextcloud.com>
  • Loading branch information
ShGKme committed Apr 15, 2023
1 parent 702973a commit 9f612ef
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions webpack.config.js
Expand Up @@ -46,7 +46,7 @@ module.exports = {
output: {
path: path.resolve('./js'),
publicPath: path.join('/apps/', appName, '/js/'),

// Output file names
filename: `${appName}-[name].js?v=[contenthash]`,
chunkFilename: `${appName}-[name].js?v=[contenthash]`,
Expand Down Expand Up @@ -78,9 +78,9 @@ module.exports = {
'Access-Control-Allow-Origin': '*',
},
},

cache: !isDev,

optimization: {
chunkIds: 'named',
splitChunks: {
Expand Down Expand Up @@ -108,7 +108,10 @@ module.exports = {

// Make sure we auto-inject node polyfills on demand
// https://webpack.js.org/blog/2020-10-10-webpack-5-release/#automatic-nodejs-polyfills-removed
new NodePolyfillPlugin(),
new NodePolyfillPlugin({
// These modules available in the web-browser
excludeAliases: ['console', 'Buffer'],
}),

// Make appName & appVersion available as a constant
new webpack.DefinePlugin({ appName: JSON.stringify(appName) }),
Expand Down

0 comments on commit 9f612ef

Please sign in to comment.