Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"SyntaxError: Unexpected token export(…)"

That's driving me nuts. I am using angular2-quickstart as a starter project. I just added @ngrx/store, @ngrx/core and @ngrx/effects to the project. Now I am getting the error in the title. I don't know how to track the error down as I'm not getting a descriptive error:

(anonymous function)    @   (index):18
ZoneDelegate.invoke @   zone.js:192
Zone.run    @   zone.js:85
(anonymous function)    @   zone.js:451
ZoneDelegate.invokeTask @   zone.js:225
Zone.runTask    @   zone.js:125
drainMicroTaskQueue @   zone.js:357
ZoneTask.invoke @   zone.js:297

Any ideas or references about resolving the cryptic errors SystemJS raises?

like image 522
Élodie Petit Avatar asked Jun 07 '26 21:06

Élodie Petit


1 Answers

You can solve it loading UMD modules using this systemjs config:

System.config({
    map: {
      ...
      '@ngrx': 'node_modules/@ngrx',
    },
    package: {
      ...
      '@ngrx/core': { main: '/bundles/core.umd.js', defaultExtension: 'js' },
      '@ngrx/store': { main: '/bundles/store.umd.js', defaultExtension: 'js' },
      '@ngrx/effects': { main: '/bundles/effects.umd.js', defaultExtension: 'js' },
      '@ngrx/store-devtools': { main: '/bundles/store-devtools.umd.js', defaultExtension: 'js' },
      '@ngrx/store-log-monitor': { main: '/bundles/store-log-monitor.umd.js', defaultExtension: 'js' },
    }
})

I'm using these version:

core 1.2.0 / store 2.2.1 / effects 2.0.0 / store-devtools 3.1.0 / store-log-monitor 3.0.2

like image 151
bertrandg Avatar answered Jun 10 '26 10:06

bertrandg



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!