this error showed up when i upgraded our webapp to...
# javascript
n
this error showed up when i upgraded our webapp to kotlin 1.5.10
Copy code
Module parse failed: 'import' and 'export' may appear only with 'sourceType: module' (9:0)
File was processed with these loaders:
 * ../../node_modules/source-map-loader/dist/cjs.js
You may need an additional loader to handle the result of these loaders.
|  *
|  */
> export { FluentBundle } from "./bundle.js";
| export { FluentResource } from "./resource.js";
| export { FluentType, FluentNone, FluentNumber, FluentDateTime } from "./types.js";
  SyntaxError: Unexpected token ')'
  at C:/Users/nikky/AppData/Local/Temp/_karma_webpack_600784/runtime.js:1:0
i guess this is because webpack was updated, but i am completely clueless how to go about fixing this
i
You can use
Copy code
kotlin.js.webpack.major.version=4
in
gradle.properties
to back to webpack 4 Possibly you use some custom loaders or plugins with not the latest version, and it can be updated to be compatible with webpack 5
n
it seems to fix itself by removing the handwritten bindings for
Copy code
implementation(npm("@fluent/bundle", "0.16.1"))
is there a current guide on how to write kotlin bindings for js code ? the current ones i have seem to cause errors compiling
b
Not really. It's mainly trial and error for each case, since there are so many ways to declare imports and exports in js...
n
found a fix for the library: https://github.com/webpack/webpack/issues/11597#issuecomment-705114717 now i am just left a different weird error related to karma
Copy code
SyntaxError: Unexpected token ')'
  at C:/Users/nikky/AppData/Local/Temp/_karma_webpack_394117/runtime.js:1:0


java.lang.IllegalStateException: command 'C:\Users\nikky\.gradle\nodejs\node-v14.15.4-win-x64\node.exe' exited with errors (exit code: 1)
i am not sure if that is webpack related or not anymore
seems to be caused by using
Copy code
usePhantomJS()