Skip to content
This repository has been archived by the owner on Aug 13, 2024. It is now read-only.

Plugin uses ES6 syntax when installed #25

Closed
frederikschubert opened this issue Jan 23, 2016 · 6 comments
Closed

Plugin uses ES6 syntax when installed #25

frederikschubert opened this issue Jan 23, 2016 · 6 comments

Comments

@frederikschubert
Copy link

After installing this plugin via jspm install scss=sass the import of the plugin fails because it uses ES6 syntax.

[email protected]:1 Uncaught SyntaxError: Unexpected token export
...

I am using this plugin to transpile my TypeScript code to ES5 but I did not manage to configure it in a way to also transpile plugin-sass.

@frederikschubert
Copy link
Author

So what I am basically asking for would be an es5 transpiled build of the plugin in the npm distribution. :)

@screendriver
Copy link
Collaborator

Unfortunately I don't have any experience with TypeScript or any other transpilers than Babel. So I don't know how solve this directly. One solution would be to distribute only ES5 code but therefore I have to change package. Maybe there is an jspm / SystemJS API for that but I only know this documentation. The whole SystemJS thing is build around ES6 / ES2015. Maybe someone other than me can help here? We / you could ask Guy Bedford and make an issue at SystemJS in parallel of this?

So what I am basically asking for would be an es5 transpiled build of the plugin in the npm distribution. :)

There is no npm distribution. The plugin is installed directly from GitHub.

@frederikschubert
Copy link
Author

Thank you for your response! I will try if it is possible to use the typescript and babel transpilers together, to solve this problem. If that doesn't work I will open an issue at the SystemJS repo.

@screendriver
Copy link
Collaborator

👍

@peterjuras
Copy link

You are probably running into this issue because you set the jspm property 'transpiler' to not use a transpiler (i.e. false). This means that not even the modules inside jspm_packages will be compiled and that is why you get the Unexpected token error. Most modules that are meant to be used with jspm/systemjs are written in ES6, so setting transpiler to false will not work in most cases.

An easy solution is to set the jspm transpiler to babel. Your TypeScript files will remain untouched, because they are loaded by the typescript-plugin and will be skipped by the compiler.

I created a sample project in which you can see a working configuration example. Try setting the transpiler to 'false' and you will see the error you mentioned. When you leave the default transpiler as babel, everything should work fine.

@frederikschubert
Copy link
Author

Ok I see. Thank you for your support! This solution works for me.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants