I have a Preact project that uses Webpack 4 as it's bundling utility. I want to update to Webpack 5. I encountered lots of errors and changes that had to be done and right now I am almost at the end of it. But I am currently facing a huge blocker.
The project I work on has a webpack-server.config that uses wrapper-webpack-plugin at one point and it looks like this:
new WrapperPlugin({
test: /\.js$/,
header: `
exports['setupGlobals'] = function (globals) {
var navigator = globals.navigator;
var location = globals.location;
var render = `,
footer: `
return { render: render };
}`
})
Hello, guys!
I have a Preact project that uses Webpack 4 as it's bundling utility. I want to update to Webpack 5. I encountered lots of errors and changes that had to be done and right now I am almost at the end of it. But I am currently facing a huge blocker.
The project I work on has a
webpack-server.config
that uses wrapper-webpack-plugin at one point and it looks like this:Later it uses
setupGlobals().render()
as:After I upgraded Webpack 4 -> Webpack 5, this Wrapper doesn't work anymore. It returns render as undefined so it can't be called.
The build is working
webpack 5.84.0 compiled -> Build done!
but when I try to access the app via browser, I get error 500 and this error:Does anyhow have any idea why this wrapper wouldn't work in Webpack 5? Thanks a bunch!