Skip to content

Commit

Permalink
Merge branch 'next-32712/improve-webpack-performance' into 'trunk'
Browse files Browse the repository at this point in the history
NEXT-32712 - Improve webpack performance

See merge request shopware/6/product/platform!12165
  • Loading branch information
jleifeld committed Dec 20, 2023
2 parents bf2dd4b + 305a512 commit 2b8e87a
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 16 deletions.
2 changes: 2 additions & 0 deletions .gitlab/stages/11-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

Build:
extends: .base-with-node
variables:
SHOPWARE_ADMIN_SKIP_SOURCEMAP_GENERATION: '1'
stage: lint
needs: []
services:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
title: Improve webpack performance
issue: NEXT-32712
---

# Administration

* Added environment variable `SHOPWARE_ADMIN_SKIP_SOURCEMAP_GENERATION` to skip source map generation
33 changes: 17 additions & 16 deletions src/Administration/Resources/app/administration/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ if (process.env.IPV4FIRST) {
/* eslint-disable */
const buildOnlyExtensions = process.env.SHOPWARE_ADMIN_BUILD_ONLY_EXTENSIONS === '1';
const openBrowserForWatch = process.env.DISABLE_DEVSERVER_OPEN !== '1';
const useSourceMap = process.env.SHOPWARE_ADMIN_SKIP_SOURCEMAP_GENERATION !== '1';

const flagsPath = path.join(process.env.PROJECT_ROOT, 'var', 'config_js_features.json');
let featureFlags = {};
Expand All @@ -37,7 +38,7 @@ if (fs.existsSync(flagsPath)) {
}

const nodeMajor = process.versions.node.split('.')[0];
const supportedNodeVersions = ['18', '19', '20'];
const supportedNodeVersions = ['20'];
if (!supportedNodeVersions.includes(nodeMajor)) {
console.log();
console.log(chalk.red(`@Deprecated: You are using an incompatible Node.js version. Supported versions are ` + supportedNodeVersions.join(', ')));
Expand Down Expand Up @@ -187,7 +188,7 @@ const baseConfig = ({ pluginPath, pluginFilepath }) => ({
hints: false,
},

devtool: isDev ? 'eval-source-map' : 'source-map',
devtool: useSourceMap ? (isDev ? 'eval-source-map' : 'source-map') : false,

optimization: {
...(() => {
Expand All @@ -198,7 +199,7 @@ const baseConfig = ({ pluginPath, pluginFilepath }) => ({
terserOptions: {
warnings: false,
output: 6,
sourceMap: true,
sourceMap: useSourceMap,
},
parallel: true,
}),
Expand Down Expand Up @@ -339,7 +340,7 @@ const baseConfig = ({ pluginPath, pluginFilepath }) => ({
{
loader: 'css-loader',
options: {
sourceMap: true,
sourceMap: useSourceMap,
url: cssUrlMatcher
},
},
Expand All @@ -358,7 +359,7 @@ const baseConfig = ({ pluginPath, pluginFilepath }) => ({
{
loader: 'css-loader',
options: {
sourceMap: true,
sourceMap: useSourceMap,
url: cssUrlMatcher,
},
},
Expand All @@ -377,15 +378,15 @@ const baseConfig = ({ pluginPath, pluginFilepath }) => ({
{
loader: 'css-loader',
options: {
sourceMap: true,
sourceMap: useSourceMap,
url: cssUrlMatcher,
},
},
{
loader: 'less-loader',
options: {
javascriptEnabled: true,
sourceMap: true,
sourceMap: useSourceMap,
},
},
],
Expand All @@ -403,15 +404,15 @@ const baseConfig = ({ pluginPath, pluginFilepath }) => ({
{
loader: 'css-loader',
options: {
sourceMap: true,
sourceMap: useSourceMap,
url: cssUrlMatcher,
},
},
{
loader: 'sass-loader',
options: {
indentedSyntax: true,
sourceMap: true,
sourceMap: useSourceMap,
},
},
],
Expand All @@ -430,14 +431,14 @@ const baseConfig = ({ pluginPath, pluginFilepath }) => ({
{
loader: 'css-loader',
options: {
sourceMap: true,
sourceMap: useSourceMap,
url: cssUrlMatcher,
},
},
{
loader: 'sass-loader',
options: {
sourceMap: true,
sourceMap: useSourceMap,
},
},
],
Expand All @@ -455,14 +456,14 @@ const baseConfig = ({ pluginPath, pluginFilepath }) => ({
{
loader: 'css-loader',
options: {
sourceMap: true,
sourceMap: useSourceMap,
url: cssUrlMatcher,
},
},
{
loader: 'stylus-loader',
options: {
sourceMap: true,
sourceMap: useSourceMap,
},
},
],
Expand All @@ -480,14 +481,14 @@ const baseConfig = ({ pluginPath, pluginFilepath }) => ({
{
loader: 'css-loader',
options: {
sourceMap: true,
sourceMap: useSourceMap,
url: cssUrlMatcher,
},
},
{
loader: 'stylus-loader',
options: {
sourceMap: true,
sourceMap: useSourceMap,
},
},
],
Expand Down Expand Up @@ -798,7 +799,7 @@ const configsForPlugins = pluginEntries.map((plugin) => {
}],
options: {
absolutePath: true,
sourceMap: true,
sourceMap: useSourceMap,
transformer: (path) => {
return path.replace('static/', '');
},
Expand Down

0 comments on commit 2b8e87a

Please sign in to comment.