Created
June 14, 2019 18:13
-
-
Save theednaffattack/5c65da0fde178a412ad3cbd1e6c3f994 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// APP_ROOT/server.js | |
const { Meep: ReactSSR } = require("./src/ssr") | |
const sheet = new ServerStyleSheet() | |
try { | |
const html = renderToString(sheet.collectStyles(<ReactSSR />)) | |
const styleTags = sheet.getStyleTags() // or sheet.getStyleElement(); | |
} catch (error) { | |
// handle error | |
console.error(error) | |
} finally { | |
sheet.seal() | |
} | |
// results in Unexpected token error "<" | |
// ========================= | |
// .babelrc | |
{ | |
"presets": [ | |
"@babel/preset-react", | |
[ | |
"@babel/preset-env", | |
{ | |
"modules": false | |
} | |
] | |
], | |
"plugins": [ | |
[ | |
"@babel/plugin-transform-react-jsx", | |
{ | |
"pragma": "dom" | |
} | |
], | |
[ | |
"babel-plugin-styled-components", | |
{ | |
"pure": true | |
} | |
] | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment