Closed Lukaszz112 closed 5 months ago
I'm gonna need some logs to assist.
Compiled with problems:X
WARNING in ../../node_modules/better-sqlite3/lib/database.js 50:10-81
Critical dependency: the request of a dependency is an expression
ERROR in ../../node_modules/better-sqlite3/lib/database.js 2:11-24
Module not found: Error: Can't resolve 'fs' in '(projectdir)/build/js/node_modules/better-sqlite3/lib'
ERROR in ../../node_modules/better-sqlite3/lib/database.js 3:13-28
Module not found: Error: Can't resolve 'path' in '(projectdir)/build/js/node_modules/better-sqlite3/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.
Something like that.
AH, right. This has nothing to do with this plugin, but there are way people have managed to go around this issue.
What you need to do is basically copy ktor's strategy and rely on dynamic types and loading the dependency via js("require('fs')")
and checking for window == undefined
beforehand to detect browser environment. For some node dependencies you could find browser polyfills.
See https://youtrack.jetbrains.com/issue/KT-47038 for a wider discussion.
I use in my common lib sqldelight and kottage wchich probably requires fs on other platforms, how can i config it to hide this errors on web browser?
cause of binaries.library() doesnt have browserProductionWebpack task