Robert Jaros
01/05/2024, 12:32 PMwasmJsBrowserProductionWebpack
task, the created js file contains some code with full paths of my linux machine:
[...] {l=(await import("node:module")).default.createRequire("file://
/home/rjaros/git/kilua/build/js/packages/kilua-examples-hello-world-wasm-js/kotlin/kilua-examples-hello-world-wasm-js.uninstantiated.mjs");const e=l("fs"),t=l("path"),r=l("u
rl").fileURLToPath("file:///home/rjaros/git/kilua/build/js/packages/kilua-examples-hello-world-wasm-js/kotlin/kilua-examples-hello-world-wasm-js.uninstantiated.mjs"),o=t.dir
name(r),n=e.readFileSync(t.resolve(o,c)),s=new WebAssembly.Module(n); [...]
Seems to me like a small privacy exposure which doesn't seem to be required for anything (the app works fine when published from a web server without this path/file).Artem Kobzar
01/05/2024, 12:43 PMIlya Goncharov [JB]
01/05/2024, 12:52 PMSvyatoslav Kuzmich [JB]
01/05/2024, 1:25 PMimport.meta.url
, used for relative path resolution in Node.js. Ilya, do you think we can stop it, maybe by avoiding transpiling ES modules?Ilya Goncharov [JB]
01/05/2024, 1:33 PMimport.meta.url
indeed. There is option in webpack to disable evaluation of it.
We can use it in Gradle plugin, but now you can add it to webpack configuration locally
https://webpack.js.org/configuration/module/#moduleparserjavascriptimportmetaRobert Jaros
01/05/2024, 2:04 PMconfig.module.parser = {
javascript: {
importMeta: false,
},
};
Robert Jaros
01/05/2024, 2:06 PMUncaught SyntaxError: import.meta may only appear in a module
Ilya Goncharov [JB]
01/05/2024, 2:09 PMRobert Jaros
04/14/2024, 10:28 AMIlya Goncharov [JB]
04/15/2024, 12:06 PMimport.meta.resolve
(https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/import.meta/resolve)
Webpack does not transform it into local file pathsRobert Jaros
04/15/2024, 1:12 PMIlya Goncharov [JB]
04/16/2024, 8:39 AMRobert Jaros
04/16/2024, 9:12 AMIlya Goncharov [JB]
04/16/2024, 9:36 AM