diegohaz/styled-tools

Transpiling the src to ES5

declanelcocks opened this issue · 7 comments

I'm using styled-tools within my project (using your ARc boilerplate), and noticed that in your .babelrc you are just targeting the last 2 browsers. When I try to build my app, it ignores /node_modules/ so it won't try and transpile the source code of this package. Because this package is not transpiling to ES5, UglifyJS is throwing an error because it cannot read the source code and the build will fail. Can you update this package to transpile to ES5? Will also have the same issue with styled-theme.

Hey, @declanelcocks. Could you please copy and paste the UglifyJS error here? Also, what's your NodeJS version?

@diegohaz Sure.

ERROR in app.d0b2887e9d5bc3a09390.js from UglifyJs
SyntaxError: Unexpected token: operator (>) [app.d0b2887e9d5bc3a09390.js:65390,48]
error Command failed with exit code 2.

This line in app.js is const get = exports.get ..... from styled-tools as it contains an arrow function. My node version is 7.1.0.

It's weird, I can't reproduce it. Does it happen on ARc without modifications (clone the repository and npm run build)? You are the first person to have problems with that.

Yep, I also had the error with just the standard ARc boilerplate but this was with my own src files. I will investigate the issue by migrating part by part my own files.

If you end up concluding that the problem is with styled-tools/styled-theme, I would accept a PR configuring babel-preset-env to fix this. 👍

@declanelcocks Did you manage to get rid of this or is this still a problem?

Sorry I didn't reply to close this as I ran into the issue again a couple of days ago. I haven't found the reason for why it was happening, but I'm 100% sure it's not the transpiling of this library which is causing it so it's safe to close the issue.