Skip to content

Instantly share code, notes, and snippets.

@axross
Created September 2, 2019 09:37
Show Gist options
  • Save axross/9f8efcb9282a3bc2dec902dc0e2aff9a to your computer and use it in GitHub Desktop.
Save axross/9f8efcb9282a3bc2dec902dc0e2aff9a to your computer and use it in GitHub Desktop.
import * as React from "react";
import * as ReactDOMServer from "react-dom/server";
function SomeComponent() {
return React.createElement(StyledDiv, null, "Hello!");
}
const StyledDiv = styled.div`
color: red;
`;
const rendered = ReactDOMServer.renderToString(React.createElement(StyledDiv));
const path = require("path");
module.exports = {
mode: "development",
target: "node",
entry: "./main.js",
output: {
path: path.resolve(__dirname, "./"),
filename: "[name].bundled.js"
},
resolve: {
alias: {
"react-dom/server": path.resolve(
__dirname,
"./node_modules/react-dom/server.browser.js"
)
}
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment