Karma Jasmine – Uncaught TypeError: __webpack_require__(…).context is not a function

I had the same issue. For some reason, in our other app doing angular update automatically deleted some code in test.ts, namely: const context = require.context(‘./’, true, /\.spec\.ts$/); context.keys().forEach(context); and the declaration of require above that. I did that in my other app manually and so far it works. Maybe someone knows the reason for … Read more

Solve having more than one copy of React in the same app

In the module you are developing, add the conflicting packages to peerDependencies (and remove them from dependencies or devDependencies): // package.json “peerDependencies”: { “react”: “16.13.1”, “react-dom”: “16.13.1” }, Execute npm install in your module. Now add react and react-dom to the webpack configuration of your module as externals. These packages shouldnt be included in the … Read more

“npm run” fails with ERR_OSSL_EVP_UNSUPPORTED

Node.js version 17 has switched to using OpenSSL 3.0. They advise: While OpenSSL 3.0 APIs should be mostly compatible with those provided by OpenSSL 1.1.1, we do anticipate some ecosystem impact due to tightened restrictions on the allowed algorithms and key sizes. If you hit an ERR_OSSL_EVP_UNSUPPORTED error in your application with Node.js 17, it’s … Read more

Webpack code splitting: ChunkLoadError – Loading chunk X failed, but the chunk exists

The chunk is reachable doesn’t mean the user’s browser can parse it. For example, if the user’s browser is old. But the chunk contains new syntax. Webpack loads the chunk by jsonp. It insert <script> tag into <head>. If the js chunk file is downloaded but cannot parsed. A ChunkLoadError will be throw. You can … Read more

How can I provide parameters for webpack html-loader interpolation?

Solution 1 I found another solution, using html-loader with interpolate option. https://github.com/webpack-contrib/html-loader#interpolation { test: /\.(html)$/, include: path.join(__dirname, ‘src/views’), use: { loader: ‘html-loader’, options: { interpolate: true } } } And then in html page you can import partials html and javascript variables. <!– Importing top <head> section –> ${require(‘./partials/top.html’)} <title>Home</title> </head> <body> <!– Importing navbar … Read more

Dynamic loading of react components

Basically it boils down to pre-creating all the chunks you will ever need. Then you just need a way to dynamically refer to them. Here’s the solution I based mine on: http://henleyedition.com/implicit-code-splitting-with-react-router-and-webpack and here’s what I do since I don’t use React Router (side note: i dont find it to be a good match for … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)