Skip to content

Instantly share code, notes, and snippets.

@mauricedb
Created November 26, 2017 10:04
Show Gist options
  • Save mauricedb/f750f8765a5709c440f04ee10d04283f to your computer and use it in GitHub Desktop.
Save mauricedb/f750f8765a5709c440f04ee10d04283f to your computer and use it in GitHub Desktop.
const HtmlWebpackPlugin = require("html-webpack-plugin");
const ManifestPlugin = require("webpack-manifest-plugin");
const SWPrecacheWebpackPlugin = require("sw-precache-webpack-plugin");
const config = require("react-scripts/config/webpack.config.prod");
config.entry = "./src/index.ssr.js";
config.output.filename = "static/ssr/[name].js";
config.output.libraryTarget = "commonjs2";
delete config.output.chunkFilename;
config.target = "node";
config.externals = /^[a-z\-0-9]+$/;
delete config.devtool;
config.plugins = config.plugins.filter(
plugin =>
!(
plugin instanceof HtmlWebpackPlugin ||
plugin instanceof ManifestPlugin ||
plugin instanceof SWPrecacheWebpackPlugin
)
);
module.exports = config;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment