Skip to content

Unexpected token { in v4.4.x #268

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

Closed
tomsowerby opened this issue Dec 23, 2016 · 10 comments
Closed

Unexpected token { in v4.4.x #268

tomsowerby opened this issue Dec 23, 2016 · 10 comments
Labels

Comments

@tomsowerby
Copy link

Migrating from v4.1.0 to v4.4.3 we started getting errors when running the server:

ERROR in Unexpected token {
@ ./~/react-styleguidist/src/index.js 40:18-48 81:1-84:3

Same error back to v4.4.0.
Rolled back to v4.3.3 and all works fine.
I couldn't see any migration guide notes on the release.

Config if pretty basic:

module.exports = {
title: 'components',
components: './src/**/*.js',
skipComponentsWithoutExample: true,
serverPort: '3005',
styleguideDir: './docs',
updateWebpackConfig(webpackConfig) {
	const node_modules = path.resolve(__dirname, "node_modules");
	webpackConfig.module.loaders.push(
		{
			test: /\.js$/,
			exclude: node_modules,
			loader: 'babel'
		},
		{
			test: /\.scss$/,
			exclude: node_modules,
			loader: 'style!css-loader?modules&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]!sass?includePaths[]=./node_modules'
		},
 .... etc etc

Thanks.

@sapegin
Copy link
Member

sapegin commented Dec 23, 2016

Are you using Node 4 or 5? This issue was reported several times but I still can‘t reproduce it.

@sapegin sapegin added the bug label Dec 23, 2016
@sapegin
Copy link
Member

sapegin commented Dec 23, 2016

Thanks for the exact version where it was introduced, I could reproduce it finally!

@tomsowerby
Copy link
Author

Witnessed using the following:
Node v4.5.0
Npm v2.15.9

@sapegin
Copy link
Member

sapegin commented Dec 23, 2016

Thanks for detailed bug report, should work in 4.4.3.

I’ll add tests to prevent that later.

@tizmagik
Copy link
Collaborator

What was the issue?

@sapegin
Copy link
Member

sapegin commented Dec 25, 2016

@tizmagik Syntax not supported in Node 4/5, check the commit.

@tizmagik
Copy link
Collaborator

Oh I see. I thought we transpiled, maybe we should?

@sapegin
Copy link
Member

sapegin commented Dec 25, 2016

We transpile only browser code. Node 4+ supports enough features. We should just test that ;-)

@tizmagik
Copy link
Collaborator

Ah gotcha 👍

Another option is to also run server code through babel but behind babel-preset-env. Might not be worth it if it was just these few lines that were incompatible, but testing against older versions of node in CI would help catch these in the future, so that's good 👌

@sapegin
Copy link
Member

sapegin commented Dec 25, 2016

It makes everything more complicated with a very tiny benefit ;-)

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

No branches or pull requests

3 participants