Questions tagged [webpack-5]

221 questions
12
votes
1 answer

Webpack 5: devtool ValidationError, invalid configuration object

While migrating from Webpack 4 to Webpack 5 I got an error when using devtool with empty value (only in production mode). module.exports = { devtool: isProd ? '' : 'source-map', // entry: ... // output: ... // module: ... } The…
kmgt
  • 5,826
  • 4
  • 18
  • 41
11
votes
0 answers

Tree shaking of shared dependencies in webpack 5 module federation

I am working on an architecture for a dynamic dashboard with components fethced from different remote react bundles using webpack 5 module federation. I do have different libraries which are shared across some of these remote bundles. These packages…
8
votes
3 answers

DeprecationWarning: Compilation.assets will be frozen in future, all modifications are deprecated

I am working on a react project and when I updated webpack 4.44.2 to 5.4.0 I am getting the following message: [DEP_WEBPACK_COMPILATION_ASSETS] DeprecationWarning: Compilation.assets will be frozen in future, all modifications are…
Varinder Sohal
  • 758
  • 1
  • 11
  • 31
8
votes
2 answers

After build via Webpack 5 app stoped working on Internet Explorer (IE11)

As announced in Webpacks 5.0 release blog post build still works in most browsers after a few minor adjustments in webpack.config.js. But it stopped working in Internet Explorer (11) because the generated output is mixed ES6 and ES5 and therefore…
Bernhard
  • 4,077
  • 5
  • 30
  • 61
7
votes
2 answers

When updating Next.js v10.1.13 to webpack5, getting warnings Can't resolve 'fsevents' in chokidar

npm install next react react-dom And running Node.js v12 Created most simple pages/index.tsx export default function PageHome(props) { return <>Hello World! } (I also had TypeScript configured as per Next.js instructions but not sure if that's…
700 Software
  • 77,509
  • 74
  • 213
  • 324
7
votes
2 answers

Error: Should not import the named export 'version' (imported as 'version')

I have an ejected create-react-app project. I am getting this error after updating it to webpack 5. It was working fine with webpack v4.41.5 node v10.23.0 OS: MacOS Catalina 10.15.7 Error: Should not import the named export 'version' (imported…
Muhammad Kamal
  • 232
  • 1
  • 8
6
votes
0 answers

How to correctly expose jQuery with Webpack 5?

Is there any specific way to expose jQuery with Webpack 5? It used to work on Webpack 4 OK, with the config bellow, but it shows the Uncaught Reference Error: jQuery is not defined error now with 5. module: { rules: [ { test:…
idm
  • 167
  • 9
5
votes
0 answers

--watch not working after updateing from webpack 4 to 5

I have been migrating a project from Webpack 4 up to 5 and have hit a snag. The --watch option is no longer working with my configuration, and I've tried everything I can find. const webpack = require('webpack'); const path = require('path'); const…
4
votes
0 answers

Correct JSDoc typings for Webpack `cacheGroups` option?

I have the following code in my webpack.config.js: optimization: { splitChunks: { cacheGroups: buildWebpackCacheGroups(), }, }, In Webpack 4 I was able to annotate the return type of buildWebpackCacheGroups with JSDoc like this: /** *…
XåpplI'-I0llwlg'I -
  • 18,987
  • 23
  • 96
  • 146
4
votes
0 answers

Webpack 5 HMR issue - Cannot read property 'updatedChunkIds' of undefined

I've tried to add a HMR into my webpack 5 config and got a nasty error. First time it compiles properly, but when it comes to recompiling after code changes - it breaks with HookWebpackError: Cannot read property 'updatedChunkIds' of undefined. If I…
4
votes
1 answer

Module Federation Shared Services

I'm working on a new project using Angular 11 and Webpack 5. I am basing my work on Manfred Steyer's Module Federation Plugin Example repo, which uses Angular CLI. I can't figure out how to share a singleton service from a shared local Angular…
Mike
  • 956
  • 10
  • 15
4
votes
3 answers

How to fix deprecation warning for Chunk.modulesIterable?

I am the maintainer of external-svg-sprite-loader and I noticed that when using it with webpack 5 I get the following warning: [DEP_WEBPACK_CHUNK_MODULES_ITERABLE] DeprecationWarning: Chunk.modulesIterable: Use new ChunkGraph API The build passes…
bensampaio
  • 2,609
  • 3
  • 17
  • 18
4
votes
1 answer

webpack v5 devtool should match pattern

Setting up a simple Middleman app utilizing webpack 5, but getting this invalid configuration object error: [webpack-cli] Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema. -…
fhbi
  • 552
  • 5
  • 15
3
votes
1 answer

Error: while using devtool="source-map" option in webpack config version 5

I am getting this error while using "source-map" as value to the devtool option in webpack configurations but while using "eval" it works (but I don't want "eval"). It could be a chance that asset can be undefined or not an array. I am new to…
hitendra
  • 73
  • 6
3
votes
0 answers

How to migrate terser webpack plugin to webpack v5

If you are using webpack v5 or above you do not need to install this plugin. Webpack v5 comes with the latest terser-webpack-plugin out of the box. I am going to use webpack v5, so per doc, I removed terser: npm uninstall terser-webpack-plugin.…
Adam Cai
  • 191
  • 7
1
2 3
14 15