Skip to content

Commit

Permalink
feat: upgrade to webpack 5
Browse files Browse the repository at this point in the history
  • Loading branch information
nopol10 committed Mar 24, 2024
1 parent 6931db9 commit 0af8652
Show file tree
Hide file tree
Showing 6 changed files with 8,543 additions and 34,901 deletions.
6 changes: 3 additions & 3 deletions Dockerfile.sample
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
FROM node:16.19.0-alpine as build
FROM node:18.19.1-alpine as build

WORKDIR /app
ENV PATH /app/node_modules/.bin:$PATH

COPY package.json ./
COPY package-lock.json ./
RUN npm ci --legacy-peer-deps
RUN npm ci

COPY . ./
COPY .env.prod ./.env
ENV NODE_ENV production
RUN npm run build:web

# This uses NextJS's standalone output
FROM node:16.19.0-alpine
FROM node:18.19.1-alpine
WORKDIR /app
ENV NODE_ENV production
RUN addgroup --system --gid 1001 nodejs
Expand Down
15 changes: 9 additions & 6 deletions config/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ const BundleAnalyzerPlugin =
require("webpack-bundle-analyzer").BundleAnalyzerPlugin;
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const TerserPlugin = require("terser-webpack-plugin");
const OptimizeCssAssetsPlugin = require("optimize-css-assets-webpack-plugin");
// const OptimizeCssAssetsPlugin = require("optimize-css-assets-webpack-plugin");
const CssMinimizerPlugin = require("css-minimizer-webpack-plugin");

module.exports.optimization = {
minimize: true,
Expand All @@ -18,6 +19,7 @@ module.exports.optimization = {
output: { ascii_only: true },
},
}),
new CssMinimizerPlugin(),
],
};

Expand Down Expand Up @@ -62,11 +64,11 @@ module.exports.getRules = (devMode, root, imageOutputPath = undefined) => [
],
},
{
exclude: /node_modules/,
exclude: [/node_modules/, /\.less$/],
test: /\.scss$/,
issuer: {
exclude: /\.less$/,
},
// issuer: {
// exclude: /\.less$/,
// },
use: [
MiniCssExtractPlugin.loader,
// "@teamsupercell/typings-for-css-modules-loader",
Expand Down Expand Up @@ -95,6 +97,7 @@ module.exports.getRules = (devMode, root, imageOutputPath = undefined) => [
},
},
],
type: "javascript/auto",
},
];

Expand All @@ -106,6 +109,6 @@ module.exports.getPlugins = (devMode, envKeys, analyze) =>
})
: null,
new webpack.DefinePlugin(envKeys),
new OptimizeCssAssetsPlugin(),
// new OptimizeCssAssetsPlugin(),
analyze && new BundleAnalyzerPlugin(),
].filter(Boolean);
Loading

0 comments on commit 0af8652

Please sign in to comment.