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 { #98

Open
bpnetguy opened this issue Aug 11, 2017 · 8 comments
Open

SyntaxError: Unexpected token { #98

bpnetguy opened this issue Aug 11, 2017 · 8 comments

Comments

@bpnetguy
Copy link

With the latest version 4.1.0, I get this error. Is it not compatible with older node versions?

[1] /mnt/workspace/XXXXX/node_modules/css-modules-require-hook/lib/index.js:3
[1] const {assign, identity, negate, camelCase: camelCaseFunc, mapKeys} = require('lodash');
[1] ^
[1]
[1] SyntaxError: Unexpected token {
[1] at exports.runInThisContext (vm.js:53:16)
[1] at Module._compile (module.js:374:25)
[1] at Module._extensions..js (module.js:417:10)
[1] at Object.require.extensions.(anonymous function) [as .js] (/mnt/workspace/XXXXX/node_modules/babel-register/lib/node.js:152:7)
[1] at Module.load (module.js:344:32)
[1] at Function.Module._load (module.js:301:12)
[1] at Module.require (module.js:354:17)
[1] at require (internal/module.js:12:17)
[1] at Plugin.manipulateOptions (/mnt/workspace/XXXXX/node_modules/babel-plugin-css-modules-transform/build/index.js:150:13)
[1] at File.buildPluginsForOptions (/mnt/workspace/XXXXX/node_modules/babel-core/lib/transformation/file/index.js:280:16)
[1] scripts/start_prod.sh integration exited with code 0

@mightyaleksey
Copy link
Member

Actually should, but looks like it was a hasty release :)

I noticed, that you use the babel-plugin-css-modules-transform. Can you show me the your setup?

@mightyaleksey
Copy link
Member

I marked the 4.1.0 version with beta tag and moved latest to 4.0.6 to make some investigation. So hopefully it won't break the existing builds

@bpnetguy
Copy link
Author

@sullenor - this error get thrown in the server. It's almost as if babel isn't transpiling ES2015 code. my webpack configuration, assumes anything in node_modules is already transpiled. So natively node 4.1.0 doesn't support destructuring which is this line right here const {assign, identity, negate, camelCase: camelCaseFunc, mapKeys} = require('lodash');

I think before you package it, you should transpile it.

@bpnetguy
Copy link
Author

screen shot 2017-08-25 at 7 35 51 am

@mightyaleksey
Copy link
Member

Hi, I published version 4.2.1 with updates. Hope will solve your issue.

@pascalduez
Copy link
Contributor

pascalduez commented Sep 13, 2017

Hi,

noticed the same thing after an upgrade of css-modules-require-hook to 4.2.1, I have several components with no styles anymore: var styles = {}; in compiled code.

I use babel-plugin-css-modules-transform.

downgrading to 4.0.6 all fine again.

My setup is very close to https://github.com/pascalduez/react-module-boilerplate/blob/master/babel.config.js

I will try to reproduce in this repo.

I'm pretty sure all the impacted styles uses compose with external files: composes foo from '../Foo.css';
Something to do with the recent postcss-modules-resolve-imports update?

@mightyaleksey
Copy link
Member

mightyaleksey commented Sep 14, 2017

Hi, thank you for the feedback. I'll try to look in to it.

In the recent update I replaced parser plugin with the postcss-modules-resolve-imports to simplify the composition handling and provide some possibilities for resolving modules in future.

@pascalduez
Copy link
Contributor

The recent updates are breaking our build/libs one after the other, since it's in the same semver range.

Now on some libs we have composes errors like:

Error: composition is only allowed when selector is single :local class name not in "
15:45:33 :local(.foobar)"

Where the actual code is just .foobar.

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