Build tweaks

This commit is contained in:
Dustin Brett
2022-06-26 12:52:02 -07:00
parent 257c820b3c
commit 30d2df57e9
2 changed files with 12 additions and 6 deletions

View File

@@ -2,9 +2,9 @@
const isProduction = process.env.NODE_ENV === "production";
const withBundleAnalyzer = require("@next/bundle-analyzer")({
enabled: isProduction,
});
const bundleAnalyzer = process.env.npm_config_argv?.includes(
"build:bundle-analyzer"
);
const webpack = require("webpack");
@@ -50,4 +50,8 @@ const nextConfig = {
},
};
module.exports = withBundleAnalyzer(nextConfig);
module.exports = bundleAnalyzer
? require("@next/bundle-analyzer")({
enabled: isProduction,
})(nextConfig)
: nextConfig;

View File

@@ -8,9 +8,11 @@
"defaults and supports es6 and not ie 11 and >1%"
],
"scripts": {
"build": "yarn build:fs && yarn build:search && next build",
"build": "yarn build:prebuild && next build",
"build:bundle-analyzer": "yarn build",
"build:fs": "node scripts/fs2json.js --exclude .index --out public/.index/fs.9p.json ./public && node scripts/preloadIcons.js",
"build:html": "node scripts/minifyHtml.js",
"build:prebuild": "yarn build:fs && yarn build:search",
"build:robots": "node scripts/robots.js",
"build:search": "node scripts/searchIndex.js",
"deploy": "yarn build:robots && next export && yarn build:html",
@@ -21,7 +23,7 @@
"export": "next export",
"prepare": "husky install",
"prettier": "prettier --write .",
"start": "next start",
"start": "next build && next start",
"stylelint": "stylelint --formatter=verbose **/*.ts*",
"test": "jest",
"test:watch": "jest --watch",