|
2 miesięcy temu | |
---|---|---|
.. | ||
README.md | 2 miesięcy temu | |
optimize-standalone.js | 2 miesięcy temu |
This script removes unnecessary development dependencies from the Next.js standalone build output to reduce the production Docker image size.
The script specifically targets and removes jest-worker
packages that are bundled with Next.js but not needed in production. These packages are included because:
The script is automatically run during Docker builds via the build:docker
npm script:
# Docker build (removes jest-worker after build)
pnpm build:docker
To run the optimization manually:
node scripts/optimize-standalone.js
node_modules/.pnpm/next@*/node_modules/next/dist/compiled/jest-worker
node_modules/.pnpm/terser-webpack-plugin@*/node_modules/jest-worker
(symlinks)node_modules/.pnpm/jest-worker@*
(actual packages)Removing jest-worker saves approximately 36KB per instance from the production image. While this may seem small, it helps ensure production images only contain necessary runtime dependencies.