-
-
Notifications
You must be signed in to change notification settings - Fork 9.1k
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
Create React App - Unexpected token import in config.js #530
Comments
It's pretty great, If I can get a sample repo. |
Sure, I'll do that in a little while (npm 3.10.3, node 6.3.0) |
I have same error both in react-cdk and pure Storybook
I guess that this is a problem because of windows @guy-kdm do work under windows? it starts after strorybook v2 was released as a temporary solution I run it from |
I had a similar issue with Using |
No babelrc (cause CRA), if no one will before I'll upload a sample repo on Saturday, thanks for the help meantime |
@usulpro Yep, windows unfortunately :) |
@arunoda Rather than removing the |
size matters!!!https://www.youtube.com/watch?v=tSd4hUOcalg
so to solve this you need to change drive letter to Uppercase rem doesn't work:
cd E:\your\path_to\project
npm run storybook
rem works:
cd E:\
cd your\path_to\project
npm run storybook
rem works:
cd E:\your\path_to\project
c:
e:
npm run storybook It looks like in some cases when you open your PS sorry for so emotional. been hunting for this ugly bug for over two months. had to rebuild the workflow in the end. |
I am also having this problem. // .storybook/.babelrc
{
"presets": [
["es2015", {"modules": false, "loose": true}],
"stage-3",
"stage-2",
"react",
],
"plugins": [
"transform-class-properties",
"styled-jsx/babel",
["transform-react-jsx", { "pragma": "h"}]
]
} const { configure } = require('@kadira/storybook')
const req = require.context('../src/components', true, /story.js$/)
function loadStories() {
req.keys().forEach(filename => console.log(filename) || req(filename))
}
configure(loadStories, module)
Node version: v6.9.1 Any ideas @arunoda ? |
@cgood92 you can try to add e.g: it worked for me, I had the same problem as you. |
Adding BABEL_ENV doesn't work for me, here is my .babelrc
|
Removing the |
That would make sense, since currently that'd require webpack 2. Luckily webpack 2 support is coming! |
Hi, after running
getstorybook
in my create react app and running storybook I get:config.js?1daa:1 Uncaught SyntaxError: Unexpected token import
In the console when loading
http://localhost:9009/
and no stories loaded.Didn't tinker or anything (just plain CRA, though not an empty project)
Sorry if that's not enough information, will happily provide more if needed.
package.json:
{ "name": "grumshi", "version": "0.1.0", "private": true, "devDependencies": { "chai": "^3.5.0", "enzyme": "^2.4.1", "react-addons-test-utils": "^15.3.2", "react-dom": "^15.3.1", "react-scripts": "0.4.1", "react-test-renderer": "^15.3.2", "@kadira/storybook": "^2.21.0" }, "dependencies": { "react": "15.3.1", "react-dom": "^15.3.1", "react-helmet": "^3.1.0", "react-redux": "^4.4.5", "react-router": "^2.7.0", "react-router-redux": "^4.0.5", "react-traverse": "0.0.3", "redux": "^3.6.0" }, "scripts": { "start": "react-scripts start", "build": "react-scripts build", "test": "react-scripts test --env=jsdom", "eject": "react-scripts eject", "storybook": "start-storybook -p 9009", "build-storybook": "build-storybook" }, "eslintConfig": { "extends": "./node_modules/react-scripts/config/eslint.js" } }
On the console I get this probably related error that goes away if I remove the JSX from the default stories:
ERROR in C:/Users/Guy/Documents/Projects/grumshi/src/stories/index.js Module parse failed: C:\Users\Guy\Documents\Projects\grumshi\src\stories\index.js Unexpected token (7:4) You may need an appropriate loader to handle this file type. SyntaxError: Unexpected token (7:4) at Parser.pp$4.raise (C:\Users\Guy\Documents\Projects\grumshi\node_modules\webpack\node_modules\acorn\dist\acorn.js:2221:15) at Parser.pp.unexpected (C:\Users\Guy\Documents\Projects\grumshi\node_modules\webpack\node_modules\acorn\dist\acorn.js:603:10) at Parser.pp$3.parseExprAtom (C:\Users\Guy\Documents\Projects\grumshi\node_modules\webpack\node_modules\acorn\dist\acorn.js:1822:12) at Parser.pp$3.parseExprSubscripts (C:\Users\Guy\Documents\Projects\grumshi\node_modules\webpack\node_modules\acorn\dist\acorn.js:1715:21) at Parser.pp$3.parseMaybeUnary (C:\Users\Guy\Documents\Projects\grumshi\node_modules\webpack\node_modules\acorn\dist\acorn.js:1692:19) at Parser.pp$3.parseExprOps (C:\Users\Guy\Documents\Projects\grumshi\node_modules\webpack\node_modules\acorn\dist\acorn.js:1637:21) at Parser.pp$3.parseMaybeConditional (C:\Users\Guy\Documents\Projects\grumshi\node_modules\webpack\node_modules\acorn\dist\acorn.js:1620:21) at Parser.pp$3.parseMaybeAssign (C:\Users\Guy\Documents\Projects\grumshi\node_modules\webpack\node_modules\acorn\dist\acorn.js:1597:21) at Parser.pp$3.parseParenAndDistinguishExpression (C:\Users\Guy\Documents\Projects\grumshi\node_modules\webpack\node_modules\acorn\dist\acorn.js:1861: 32) at Parser.pp$3.parseExprAtom (C:\Users\Guy\Documents\Projects\grumshi\node_modules\webpack\node_modules\acorn\dist\acorn.js:1796:19) @ C:/Users/Guy/Documents/Projects/grumshi/.storybook/config.js 4:2-27
The text was updated successfully, but these errors were encountered: