Skip to content

Commit 20b6bd7

Browse files
authored
Trick the webpack to bypass its warnings on missing modules (#285)
Leftovers from #265
1 parent bae3fe3 commit 20b6bd7

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

core/js/src/node/nodeModulesJs.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,31 +7,31 @@ package kotlinx.io.node
77

88
internal actual val path: Path by lazy {
99
try {
10-
js("require(\"path\")")
10+
js("eval('require')('path')")
1111
} catch (e: Throwable) {
1212
throw UnsupportedOperationException("Module 'path' could not be imported", e)
1313
}
1414
}
1515

1616
internal actual val fs: Fs by lazy {
1717
try {
18-
js("require(\"fs\")")
18+
js("eval('require')('fs')")
1919
} catch (e: Throwable) {
2020
throw UnsupportedOperationException("Module 'fs' could not be imported", e)
2121
}
2222
}
2323

2424
internal actual val os: Os by lazy {
2525
try {
26-
js("require(\"os\")")
26+
js("eval('require')('os')")
2727
} catch (e: Throwable) {
2828
throw UnsupportedOperationException("Module 'os' could not be imported", e)
2929
}
3030
}
3131

3232
internal actual val buffer: BufferModule by lazy {
3333
try {
34-
js("require(\"buffer\")")
34+
js("eval('require')('buffer')")
3535
} catch (e: Throwable) {
3636
throw UnsupportedOperationException("Module 'buffer' could not be imported", e)
3737
}

0 commit comments

Comments
 (0)