Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 13 additions & 8 deletions nextjs-base/scripts/build-app.sh
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,9 @@ const __xPWA__ = (p) => {
return (nextConfig) => {
const modConfig = {...nextConfig};

modConfig.webpack = (config) => {
modConfig.webpack = (config, ...rest) => {
config.plugins.push(new webpack.DefinePlugin(envMap));
return nextConfig.webpack ? nextConfig.webpack(config) : config;
return nextConfig.webpack ? nextConfig.webpack(config, ...rest) : config;
};

return realPWA(modConfig);
Expand All @@ -125,9 +125,9 @@ EOF
const __xPWA__ = (nextConfig) => {
const modConfig = {...nextConfig};

modConfig.webpack = (config) => {
modConfig.webpack = (config, ...rest) => {
config.plugins.push(new webpack.DefinePlugin(envMap));
return nextConfig.webpack ? nextConfig.webpack(config) : config;
return nextConfig.webpack ? nextConfig.webpack(config, ...rest) : config;
};

return withPWA(modConfig);
Expand All @@ -141,9 +141,9 @@ else
const __xCfg__ = (nextConfig) => {
const modConfig = {...nextConfig};

modConfig.webpack = (config) => {
modConfig.webpack = (config, ...rest) => {
config.plugins.push(new webpack.DefinePlugin(envMap));
return nextConfig.webpack ? nextConfig.webpack(config) : config;
return nextConfig.webpack ? nextConfig.webpack(config, ...rest) : config;
};

return modConfig;
Expand Down Expand Up @@ -208,8 +208,13 @@ CUR_NEXT_VERSION=`jq -r '.version' node_modules/next/package.json`
semver -p -r ">=14.2.0" "$CUR_NEXT_VERSION"
if [ $? -eq 0 ]; then
# For >= 14.2.0
STACK_NEXT_COMPILE_COMMAND="next build --experimental-build-mode compile"
STACK_NEXT_GENERATE_COMMAND="next build --experimental-build-mode generate"
STACK_NEXT_BUNDLER_ARG=""
# Next.js >= 16 defaults to Turbopack and errors out when a webpack config is
# present without an explicit bundler flag. The runtime env substitution above
# (and any PWA plugin) needs webpack, so ask for it explicitly.
semver -p -r ">=16.0.0" "$CUR_NEXT_VERSION" && STACK_NEXT_BUNDLER_ARG="--webpack"
STACK_NEXT_COMPILE_COMMAND="next build $STACK_NEXT_BUNDLER_ARG --experimental-build-mode compile"
STACK_NEXT_GENERATE_COMMAND="next build $STACK_NEXT_BUNDLER_ARG --experimental-build-mode generate"
else
# For 13.4.2 to 14.1.x
STACK_NEXT_COMPILE_COMMAND="next experimental-compile"
Expand Down