hakimel/Ladda

Unexpected token import

Closed this issue · 2 comments

I have tried to import Ladda into Electron app with Vue and webpack. I have got this error message.

Uncaught SyntaxError: Unexpected token import
    at createScript (vm.js:80)
    at Object.runInThisContext (vm.js:139)
    at Module._compile (module.js:606)
    at Object.Module._extensions..js (module.js:653)
    at Module.load (module.js:561)
    at tryModuleLoad (module.js:504)
    at Function.Module._load (module.js:496)
    at Module.require (module.js:586)
    at require (internal/module.js:11)
    at eval (external "ladda"?71f1:1)

How to fix this bug

I think this is because Electron/Node doesn't support native ES6 modules yet. Until it does, you'll have to generate a bundle file using Rollup or Webpack to resolve imports. Either that or stick with Ladda v1.x until ES6 modules are supported.

Thank you. I will use v1.x instead