hi there 1) anyone try to avoid dce processing of...
# javascript
m
hi there 1) anyone try to avoid dce processing of polyfill file? 2) what is analogue of
require('webexteision-polyfill')
in kotlinjs?
b
2. exactly the same. Kotlin stdlib-js has a require function
m
2) with
implementation(kotlin("stdlib-js"))
it import for me
require(val: boolean)
function that assert val and throw exception if false 🤔 not same as
require
some js module
b
no, there's another one. IDE just throws you a wrong suggestion
m
ok ll check
b
import kotlinext.js.require
m
I understand what do you mean - but this one is not in stdlib-js but in https://github.com/JetBrains/kotlin-wrappers/tree/master/kotlin-extensions (an it broke build in my case)
s
You can just write your own (it's a very simple function):
Copy code
external fun require(module: String): dynamic = definedExternally
The
= definedExternally
might even be unecessary tbh
b
= definedExternally
is not needed here as it's a function. It's meant to be used for variables
s
@Big Chungus TIL
b
TIL?
s
"Today I learned"
b
😄
t
To avoid dce processing we declare npm dependencies in separate subproject.
ES6
npm dependencies also marked as
external
in webpack