Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SyntaxError: Unexpected token export #206

Closed
davidbarratt opened this issue May 5, 2017 · 3 comments
Closed

SyntaxError: Unexpected token export #206

davidbarratt opened this issue May 5, 2017 · 3 comments

Comments

@davidbarratt
Copy link

davidbarratt commented May 5, 2017

This library appears to use ES6 modules which Node.js does not support.

node_modules/angular2-notifications/dist/index.js:1
(function (exports, require, module, __filename, __dirname) { export * from './src/push-notifications.module';
                                                              ^^^^^^
SyntaxError: Unexpected token export
    at createScript (vm.js:53:10)
    at Object.runInThisContext (vm.js:95:10)
    at Module._compile (module.js:543:28)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Function.cls_wrapMethod [as _load] (node_modules/newrelic/lib/shimmer.js:256:38)
    at Module.require (module.js:498:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (dist/compiled/client/app/brand.service.js:6:32)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Function.cls_wrapMethod [as _load] (node_modules/newrelic/lib/shimmer.js:256:38)
    at Module.require (module.js:498:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (dist/compiled/server/index.js:10:23)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Function.cls_wrapMethod [as _load] (node_modules/newrelic/lib/shimmer.js:256:38)
    at Module.require (module.js:498:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (index.js:3:1)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.runMain (module.js:605:10)
    at run (bootstrap_node.js:427:7)
    at startup (bootstrap_node.js:151:9)
    at bootstrap_node.js:542:3

Would it be possible to support Node.js by not using ES6 modules in dist ?

@xealot
Copy link

xealot commented May 5, 2017

Right now the recommendation for Angular libraries is to provide both.

├── package.json 
|      typings: ./core.d.ts
|         main: ./bundles/core.umd.js
|       module: ./@angular/core.es5.js
|       es2015: ./@angular/core.js

Angular Packaging Format

@AnthonyNahas
Copy link

take a look of my solution here

@flauc
Copy link
Owner

flauc commented Nov 5, 2017

This error should be resolved with the latest release as well. Please reopen if you are still seeing it though.

@flauc flauc closed this as completed Nov 5, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants