{"action":"created","issue":{"url":"https://api.github.com/repos/mui-org/material-ui/issues/10392","repository_url":"https://api.github.com/repos/mui-org/material-ui","labels_url":"https://api.github.com/repos/mui-org/material-ui/issues/10392/labels{/name}","comments_url":"https://api.github.com/repos/mui-org/material-ui/issues/10392/comments","events_url":"https://api.github.com/repos/mui-org/material-ui/issues/10392/events","html_url":"https://github.com/mui-org/material-ui/issues/10392","id":299056591,"number":10392,"title":"Got an error when build SSR script (with webpack): Couldn't find preset \"stage-0\"","user":{"login":"JoeHetfield","id":4022524,"avatar_url":"https://avatars2.githubusercontent.com/u/4022524?v=4","gravatar_id":"","url":"https://api.github.com/users/JoeHetfield","html_url":"https://github.com/JoeHetfield","followers_url":"https://api.github.com/users/JoeHetfield/followers","following_url":"https://api.github.com/users/JoeHetfield/following{/other_user}","gists_url":"https://api.github.com/users/JoeHetfield/gists{/gist_id}","starred_url":"https://api.github.com/users/JoeHetfield/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JoeHetfield/subscriptions","organizations_url":"https://api.github.com/users/JoeHetfield/orgs","repos_url":"https://api.github.com/users/JoeHetfield/repos","events_url":"https://api.github.com/users/JoeHetfield/events{/privacy}","received_events_url":"https://api.github.com/users/JoeHetfield/received_events","type":"User","site_admin":false},"labels":[{"id":796834793,"url":"https://api.github.com/repos/mui-org/material-ui/labels/support","name":"support","color":"e57c37","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-02-21T17:18:54Z","updated_at":"2018-02-21T17:22:05Z","closed_at":"2018-02-21T17:21:33Z","author_association":"NONE","body":"- [x] I have searched the [issues](https://github.com/mui-org/material-ui/issues) of this repository and believe that this is not a duplicate.\r\n\r\n## Expected Behavior\r\nBuild should successfully done.\r\n\r\n## Current Behavior\r\nWhen I build a script for SSR with webpack and following configuration. It display an error message like: \r\n\"ERROR in ./node_modules/jss-preset-default/lib/index.js\r\nModule build failed: Error: Couldn't find preset \"stage-0\" relative to directory \"myApp\\node_modules\\jss-preset-default\"\"\r\n\r\n## Steps to Reproduce (for bugs)\r\nBuild related issue, so sorry can't provide a live link. But the reproduce step should be enough.\r\n\r\n1. Set up project with following package.json:\r\n```json\r\n{\r\n  \"name\": \"myApp\",\r\n  \"version\": \"1.0.0\",\r\n  \"description\": \"\",\r\n  \"main\": \"index.js\",\r\n  \"scripts\": {\r\n    \"start:server\": \"node ./server/index.js\",\r\n    \"start\": \"nodemon --watch webpack.config.js --exec \\\"webpack-dev-server --env development\\\"\",\r\n    \"build\": \"webpack --env production\",\r\n    \"lint:js\": \"eslint . --fix\",\r\n    \"spellcheck\": \"eslint . --config .eslintrc.spellcheck.js && echo \\\"eslint: no lint errors\\\"\",\r\n    \"test\": \"echo \\\"Error: no test specified\\\" && exit 1\"\r\n  },\r\n  \"keywords\": [],\r\n  \"author\": \"\",\r\n  \"license\": \"ISC\",\r\n  \"devDependencies\": {\r\n    \"babel-core\": \"^6.26.0\",\r\n    \"babel-eslint\": \"^8.2.1\",\r\n    \"babel-loader\": \"^7.1.2\",\r\n    \"babel-preset-env\": \"^1.6.1\",\r\n    \"babel-preset-react\": \"^6.24.1\",\r\n    \"babel-preset-stage-1\": \"^6.24.1\",\r\n    \"eslint\": \"^4.17.0\",\r\n    \"eslint-config-airbnb-base\": \"^12.1.0\",\r\n    \"eslint-import-resolver-webpack\": \"^0.8.4\",\r\n    \"eslint-plugin-import\": \"^2.8.0\",\r\n    \"eslint-plugin-react\": \"^7.6.1\",\r\n    \"eslint-plugin-spellcheck\": \"0.0.8\",\r\n    \"file-loader\": \"^1.1.6\",\r\n    \"html-webpack-plugin\": \"^2.30.1\",\r\n    \"html-webpack-template\": \"^6.1.0\",\r\n    \"nodemon\": \"^1.14.12\",\r\n    \"url-loader\": \"^0.6.2\",\r\n    \"webpack\": \"^3.11.0\",\r\n    \"webpack-dev-middleware\": \"^2.0.5\",\r\n    \"webpack-dev-server\": \"^2.11.1\",\r\n    \"webpack-merge\": \"^4.1.1\"\r\n  },\r\n  \"dependencies\": {\r\n    \"body-parser\": \"^1.18.2\",\r\n    \"classnames\": \"^2.2.5\",\r\n    \"compression\": \"^1.7.2\",\r\n    \"cookie-parser\": \"^1.4.3\",\r\n    \"cors\": \"^2.8.4\",\r\n    \"express\": \"^4.16.2\",\r\n    \"helmet\": \"^3.11.0\",\r\n    \"history\": \"^4.7.2\",\r\n    \"material-ui\": \"^1.0.0-beta.34\",\r\n    \"material-ui-icons\": \"^1.0.0-beta.17\",\r\n    \"moment\": \"^2.20.1\",\r\n    \"morgan\": \"^1.9.0\",\r\n    \"prop-types\": \"^15.6.0\",\r\n    \"pug\": \"^2.0.0-rc.4\",\r\n    \"react\": \"^16.2.0\",\r\n    \"react-dom\": \"^16.2.0\",\r\n    \"react-intl\": \"^2.4.0\",\r\n    \"react-jss\": \"^8.3.3\",\r\n    \"react-redux\": \"^5.0.6\",\r\n    \"react-router-dom\": \"^4.2.2\",\r\n    \"react-router-redux\": \"^5.0.0-alpha.9\",\r\n    \"redux\": \"^3.7.2\",\r\n    \"redux-logger\": \"^3.0.6\",\r\n    \"redux-thunk\": \"^2.2.0\",\r\n    \"response-time\": \"^2.3.2\",\r\n    \"rid\": \"0.0.1\",\r\n    \"typeface-roboto\": \"0.0.54\"\r\n  }\r\n}\r\n```\r\n2. Use this script for Server rendering (basically copied from [https://material-ui-next.com/guides/server-rendering/](https://material-ui-next.com/guides/server-rendering/)):\r\n```js\r\nimport React from 'react';\r\nimport { renderToString } from 'react-dom/server';\r\nimport { Provider } from 'react-redux';\r\nimport { JssProvider, SheetsRegistry } from 'react-jss';\r\nimport { MuiThemeProvider, createMuiTheme, createGenerateClassName } from 'material-ui/styles';\r\nimport { createStore, applyMiddleware } from 'redux';\r\nimport thunkMiddleware from 'redux-thunk';\r\nimport { createLogger } from 'redux-logger';\r\nimport rootReducer from 'reducers';\r\nimport { Route, Switch } from 'react-router-dom';\r\nimport createHistory from 'history/createBrowserHistory';\r\nimport { ConnectedRouter, routerMiddleware } from 'react-router-redux';\r\n\r\nimport Main from 'pages';\r\n// import theme from './theme';\r\n\r\nexport default (req, res) => {\r\n  const history = createHistory();\r\n  const routeMiddleware = routerMiddleware(history);\r\n  const loggerMiddleware = createLogger();\r\n\r\n  const store = createStore(\r\n    rootReducer,\r\n    applyMiddleware(\r\n      routeMiddleware,\r\n      thunkMiddleware,\r\n      loggerMiddleware,\r\n    ),\r\n  );\r\n\r\n  // Create a sheetsRegistry instance.\r\n  const sheetsRegistry = new SheetsRegistry();\r\n\r\n  // Create a theme instance.\r\n  const theme = createMuiTheme();\r\n\r\n  const generateClassName = createGenerateClassName();\r\n\r\n  // Render the component to a string.\r\n  const html = renderToString(\r\n    <JssProvider registry={sheetsRegistry} generateClassName={generateClassName}>\r\n      <MuiThemeProvider theme={theme} sheetsManager={new Map()}>\r\n        <Provider store={store}>\r\n          <ConnectedRouter history={history}>\r\n            <Switch>\r\n              {/* <Route path='/signin' component={SignIn} /> */}\r\n              <Route path='/' component={Main} />\r\n            </Switch>\r\n          </ConnectedRouter>\r\n        </Provider>\r\n      </MuiThemeProvider>\r\n    </JssProvider>,\r\n  );\r\n\r\n  // Grab the CSS from our sheetsRegistry.\r\n  const css = sheetsRegistry.toString();\r\n\r\n  res.render('index', {\r\n    html,\r\n    css,\r\n  });\r\n};\r\n```\r\n3. Run the webpack-dev-server by:\r\n`\r\nnpm start\r\n`\r\n4. Got a error like this:\r\n![_20180222010151](https://user-images.githubusercontent.com/4022524/36494081-1440c910-176c-11e8-8bd5-63fd6141e8f0.png)\r\n\r\n\r\n## Context\r\nI was trying to write a script as express middle ware for server-side rendering. Cause Node can't recognize the jsx syntax, so I want to build this script by babel in webpack then use the tarnspiled result. I installed preset-stage-0 and tried again after I got this error, but it further requested the following babel plugin: preset-es2015, transform-es3-member-expression-literals, transform-es3-property-literals.\r\n\r\nThis is my .bablerc is this:\r\n```json\r\n{\r\n  \"presets\": [\r\n    \"env\",\r\n    \"stage-1\",\r\n    \"react\"\r\n  ]\r\n}\r\n```\r\n\r\nI want use some stable language features, so I prefer stage-1. And the webpack recommended to use 'env' instead 'es2015'. \r\n\r\n## Your Environment\r\n<!--- Include as many relevant details about the environment with which you experienced the bug. -->\r\n\r\n| Tech         | Version |\r\n|--------------|---------|\r\n| Material-UI  | 1.0.0-beta.34 |\r\n| React        | 16.2.0 |\r\n| browser      | Chrome |\r\n| Webpack          | 3.11.0 |\r\n"},"comment":{"url":"https://api.github.com/repos/mui-org/material-ui/issues/comments/367402746","html_url":"https://github.com/mui-org/material-ui/issues/10392#issuecomment-367402746","issue_url":"https://api.github.com/repos/mui-org/material-ui/issues/10392","id":367402746,"user":{"login":"oliviertassinari","id":3165635,"avatar_url":"https://avatars2.githubusercontent.com/u/3165635?v=4","gravatar_id":"","url":"https://api.github.com/users/oliviertassinari","html_url":"https://github.com/oliviertassinari","followers_url":"https://api.github.com/users/oliviertassinari/followers","following_url":"https://api.github.com/users/oliviertassinari/following{/other_user}","gists_url":"https://api.github.com/users/oliviertassinari/gists{/gist_id}","starred_url":"https://api.github.com/users/oliviertassinari/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oliviertassinari/subscriptions","organizations_url":"https://api.github.com/users/oliviertassinari/orgs","repos_url":"https://api.github.com/users/oliviertassinari/repos","events_url":"https://api.github.com/users/oliviertassinari/events{/privacy}","received_events_url":"https://api.github.com/users/oliviertassinari/received_events","type":"User","site_admin":false},"created_at":"2018-02-21T17:22:05Z","updated_at":"2018-02-21T17:22:05Z","author_association":"OWNER","body":"@JoeHetfield From my understanding of the issue, the origin in on jss side."}}
{"actor":{"display_login":"oliviertassinari"}}