iroyo
11/24/2020, 3:59 PMimplementation(npm("webextension-polyfill", "0.7.0"))
After this I'm a bit lost. Do I need to make something special to in order to get this dependency bundled alongside my kotlin code? Do I have to manually map the polyfill to kotlin code with @JsModule?turansky
11/25/2020, 7:47 AMI have to manually map the polyfill to kotlin code with @JsModule?Yes, you can to declare and use polyfill But webpack shim is preferable as I see
iroyo
11/25/2020, 8:33 AMturansky
11/25/2020, 8:53 AMThe idea is to tell webpack to include this dependency in the js output, right?Yes
How can I do it?AFAIK you can declare shims in webpack config https://webpack.js.org/guides/shimming/
iroyo
11/25/2020, 9:47 AMturansky
11/25/2020, 6:04 PMAs I understand he’s only copying the polyfill js file into the output folder?`Yes
turansky
11/25/2020, 6:05 PMdistribution
logiciroyo
11/26/2020, 11:33 AMdistribution
I can only modify the directory
output, right? Maybe I misunderstood you.turansky
11/27/2020, 6:08 AMshim
inside js file:
1. Add dependency and webpack configuration for shim
or
2. Add dependency and require polyfill at app start
--------------------
If you want copy polyfills to distributions
folder:
3. Add configuration for “distribution” Copy
taskturansky
11/27/2020, 6:09 AMHey Victor I know you’ve helped me enough alreadyFeel free to ask as many questions as you really need
iroyo
11/27/2020, 1:57 PMbrowser {
distribution {
copy {
from("build/js/node_modules/webextension-polyfill/dist") {
include("browser-polyfill.min.js")
}
into("$projectDir/extension/output/")
}
directory = File("$projectDir/extension/output/")
}
Does it make sense?
Again Victor, thanks you for your patience!turansky
11/27/2020, 4:07 PMwebpack.config.js
2. require
call in Kotlin
3. Copy task configurationturansky
11/27/2020, 4:09 PM