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

Unable to load transpiler to transpile .../d3-ng2-service/index.js #14

Closed
sdeuvarow opened this issue Oct 26, 2016 · 5 comments
Closed

Comments

@sdeuvarow
Copy link

sdeuvarow commented Oct 26, 2016

When using systemjs to load the app, I'm getting the following issue:

services:35 Error: (SystemJS) Unexpected token <
    SyntaxError: Unexpected token <
    Evaluating http://localhost:8081/traceur
    Error loading http://localhost:8081/traceur
    **Unable to load transpiler to transpile http://localhost:8081/node_modules/d3-ng2-service/index.js**
    Error loading http://localhost:8081/node_modules/d3-ng2-service/index.js as "d3-ng2-service" from http://localhost:8081/app/core/core.module.js

This is the content of the d3-ng2-service/index.js HTTP response:

export * from './src/d3.service';
//# sourceMappingURL=index.js.map

In the live-example there is no loader, so it doesn't show how to configure a loader to use the d3-ng2-service. Do you have an example of that? I'd like to see the lib working with a loader to check what am I doing wrong.

This is my systemjs config:

...
paths: {
          'npm:': 'node_modules/'
        },
map: {
          ....
          'd3-ng2-service': 'npm:d3-ng2-service/index.js',
          .....
       }
...

thanks!

@thanhnguyenminh
Copy link

I got the same error with @sdeuvarow

@tomwanzek
Copy link
Owner

The current version of the service exposes two entry points:
"main": "index.js": compiled from TypeScript with ES5 target and ES2015 module structure
"jsnext:main": "esm/index.js": compiled from TypeScript with ES2015 target and ES2015 module structure

So in either case the module loader has to be able to understand ES2015 module structure (e.g. Webpack2 now has native support for loading with ES2015 module structure. This is what angular-cli uses under the hood.)

As your above code references traceur are you set up to handle ES2015 modules?

@tomwanzek
Copy link
Owner

In the case of systemJS there is also the SystemJS Babel plugin.

I used SystemJs with Angular 1.x, but have since moved away from it alongside the move angular-cli made.

I contemplated earlier to provide a UMD entry point, but ran into some issues with the combined Rollup of the d3 modules and the bundle/service parts of this library.

@sdeuvarow
Copy link
Author

Finally I decided to update my app to use webpack of angular-cli. So, as u told, I don't have the issue using webpack.

Thanks!

@tomwanzek
Copy link
Owner

That's the other way to go... 😄

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

3 participants