Gleb
02/17/2023, 1:30 AMbuffer
.
The error I'm getting:
Buffer is not defined
calculateChecksum@/run/user/1000/_karma_webpack_946395/commons.js
build.gradle.kts:
js(IR) {
moduleName = "kotlin-wallet-sdk"
nodejs()
browser {
testTask { useKarma { useFirefox() } }
}
binaries.library()
}
I tried adding this to webpack.config.d:
module.exports = {
resolve: {
fallback: {
buffer: require.resolve('buffer'),
},
},
};
But it didn't work.
I noticed that karma.js uses webpack config object, so i tried to set
config.module.exports = {
resolve: {
fallback: {
buffer: require.resolve('buffer'),
},
},
};
But it gives me an error
ValidationError: Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema.
- configuration.module has an unknown property 'exports'. These properties are valid:
object { defaultRules?, exprContextCritical?, exprContextRecursive?, exprContextRegExp?, exprContextRequest?, generator?, noParse?, parser?, rules?, strictExportPresence?, strictThisContextOnImports?, unknownContextCritical?, unknownContextRecursive?, unknownContextRegExp?, unknownContextRequest?, unsafeCache?, wrappedContextCritical?, wrappedContextRecursive?, wrappedContextRegExp? }
Any ideas/recommendations?
Setting webpack version to 4 resolves this issue, but I'm pretty sure there is a proper way of fixing it without rollbacking to older version of the webpack