build production

This commit is contained in:
2023-05-17 23:36:34 +01:00
parent dce003d7f0
commit fcb8e633fc
4 changed files with 45 additions and 6 deletions

View File

@ -46,7 +46,7 @@
},
"scripts": {
"start": "webpack serve",
"build": "webpack --mode=production",
"build": "webpack --node-env=production",
"test": "",
"intl-extract": "formatjs extract 'src/**/*.ts*' --ignore='**/*.d.ts' --out-file src/lang.json --flatten true",
"intl-compile": "formatjs compile src/lang.json --out-file src/translations/en.json",
@ -89,6 +89,7 @@
"@webscopeio/react-textarea-autocomplete": "^4.9.2",
"babel-loader": "^9.1.2",
"babel-plugin-formatjs": "^10.5.1",
"copy-webpack-plugin": "^11.0.0",
"css-loader": "^6.7.3",
"css-minimizer-webpack-plugin": "^5.0.0",
"customize-cra": "^1.0.0",

View File

@ -6,6 +6,7 @@ const TerserPlugin = require("terser-webpack-plugin");
const ESLintPlugin = require("eslint-webpack-plugin");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const CssMinimizerPlugin = require("css-minimizer-webpack-plugin");
const CopyPlugin = require("copy-webpack-plugin");
const TsTransformer = require("@formatjs/ts-transformer");
const isProduction = process.env.NODE_ENV == "production";
@ -33,9 +34,18 @@ const config = {
historyApiFallback: true,
},
plugins: [
new CopyPlugin({
patterns: [
{ from: "public/manifest.json" },
{ from: "public/robots.txt" },
{ from: "public/nostrich_512.png" },
{ from: "public/nostrich_256.png" },
],
}),
new HtmlWebpackPlugin({
template: "public/index.html",
favicon: "public/favicon.ico",
excludeChunks: ["sw"],
}),
new ESLintPlugin(),
new MiniCssExtractPlugin({
@ -119,7 +129,7 @@ module.exports = () => {
config.mode = "production";
config.entry.sw = {
import: "./src/service-worker.ts",
name: "sw.js",
filename: "service-worker.js",
};
} else {
config.mode = "development";