Skip to content

Instantly share code, notes, and snippets.

@JWLangford
Created July 2, 2021 12:53
Show Gist options
  • Save JWLangford/383e84a50101aa14ede21dac42e71d28 to your computer and use it in GitHub Desktop.
Save JWLangford/383e84a50101aa14ede21dac42e71d28 to your computer and use it in GitHub Desktop.
module.exports = () => {
return {
node: {
fs: "empty",
},
entry: ["./src/index.tsx"],
module: {
rules: [
{
test: /\.(ts|tsx)$/,
exclude: /node_modules/,
use: {
loader: "babel-loader",
},
},
{
test: /\.css$/i,
use: ["style-loader", "css-loader"],
},
{
test: /\.svg$/,
use: [
{
loader: "svg-url-loader",
options: {
limit: 10000,
},
},
],
},
],
},
resolve: {
extensions: [".tsx", ".ts", ".js", ".jsx", ".css"],
},
output: {
filename: "[name].[hash].js",
chunkFilename: "[name].[hash].js",
publicPath: "/",
},
mode: "production",
plugins: [
new HtmlWebpackPlugin({
template: "public/index-prod.html",
}),
new webpack.DefinePlugin({
"process.env": {
NODE_ENV: JSON.stringify(process.env.NODE_ENV),
},
}),
],
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment