I’m trying to bump a project from Ktor 3.0.1 to Kt...
# ktor
c
I’m trying to bump a project from Ktor 3.0.1 to Ktor 3.0.2. I’ve got a Compose HTML client app (Kotlin/JS) that uses Ktor. When I make the version bump to 3.0.2, I’m seeing a lot of webpack errors. Is there some kind of Gradle script migration needed for the latest Ktor version?
Example
Copy code
Module not found: Error: Can't resolve 'bufferutil' in '~/project//build/js/node_modules/ws/lib'
Module not found: Error: Can't resolve 'utf-8-validate' in '~/project//build/js/node_modules/ws/lib'
Module not found: Error: Can't resolve 'zlib' in '~/project//build/js/node_modules/ws/lib'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
	- add a fallback 'resolve.fallback: { "zlib": require.resolve("browserify-zlib") }'
	- install 'browserify-zlib'
If you don't want to include a polyfill, you can use an empty module like this:
	resolve.fallback: { "zlib": false }

Module not found: Error: Can't resolve 'stream' in '~/project//build/js/node_modules/ws/lib'
Did you mean './stream'?
Requests that should resolve in the current directory need to start with './'.
Requests that start with a name are treated as module requests and resolve within module directories (node_modules).
If changing the source code is not an option there is also a resolve options called 'preferRelative' which tries to resolve these kind of requests in the current directory too.
a
This is a bug. I've filed an issue.
c
Ok, thanks for the quick reply. It seems like a workaround might be webpack.config.d/polyfills.js
Copy code
config.resolve = {
  ...config.resolve,
  fallback: {
    "bufferutil": false,
    "crypto": false,
    "http": false,
    "https": false,
    "net": false,
    "stream": false,
    "tls": false,
    "url": false,
    "utf-8-validate": false,
    "zlib": false,
  }
};
Although when I do that, I notice that my application is compiled into three different js files instead of a single js output like before . Is that the same bug, or a separate bug?