From 6f11e9b73152c9ffefb414150d2accec2bfc5adf Mon Sep 17 00:00:00 2001 From: Filipp Zhinkin Date: Tue, 19 Mar 2024 10:42:04 +0100 Subject: [PATCH] Trick the webpack to bypass its warnings on missing modules Leftovers from #265 --- core/js/src/node/nodeModulesJs.kt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/core/js/src/node/nodeModulesJs.kt b/core/js/src/node/nodeModulesJs.kt index a6047beea..83fe3f2f4 100644 --- a/core/js/src/node/nodeModulesJs.kt +++ b/core/js/src/node/nodeModulesJs.kt @@ -7,7 +7,7 @@ package kotlinx.io.node internal actual val path: Path by lazy { try { - js("require(\"path\")") + js("eval('require')('path')") } catch (e: Throwable) { throw UnsupportedOperationException("Module 'path' could not be imported", e) } @@ -15,7 +15,7 @@ internal actual val path: Path by lazy { internal actual val fs: Fs by lazy { try { - js("require(\"fs\")") + js("eval('require')('fs')") } catch (e: Throwable) { throw UnsupportedOperationException("Module 'fs' could not be imported", e) } @@ -23,7 +23,7 @@ internal actual val fs: Fs by lazy { internal actual val os: Os by lazy { try { - js("require(\"os\")") + js("eval('require')('os')") } catch (e: Throwable) { throw UnsupportedOperationException("Module 'os' could not be imported", e) } @@ -31,7 +31,7 @@ internal actual val os: Os by lazy { internal actual val buffer: BufferModule by lazy { try { - js("require(\"buffer\")") + js("eval('require')('buffer')") } catch (e: Throwable) { throw UnsupportedOperationException("Module 'buffer' could not be imported", e) }