@oroinc/oro-webpack-config-builder 6.1.0-lts01 → 6.1.0-lts02
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/oro-webpack-config.js
CHANGED
|
@@ -9,8 +9,6 @@ const EntryPointFileWriter = require('./writer/scss-entry-point-file-writer');
|
|
|
9
9
|
const LayoutModulesConfigLoader = require('./modules-config/layout-modules-config-loader');
|
|
10
10
|
const LayoutStyleLoader = require('./style/layout-style-loader');
|
|
11
11
|
const MapModulesPlugin = require('./plugin/map/map-modules-plugin');
|
|
12
|
-
const IntegrityFilePlugin = require('./plugin/integrity/integrity-file-plugin');
|
|
13
|
-
const {SubresourceIntegrityPlugin} = require('webpack-subresource-integrity');
|
|
14
12
|
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
|
15
13
|
const ModulesConfigLoader = require('./modules-config/modules-config-loader');
|
|
16
14
|
const DynamicImportsFileWriter = require('./writer/dynamic-imports-file-writer');
|
|
@@ -29,6 +27,7 @@ const validation = require('./validation');
|
|
|
29
27
|
const EventEmitter = require('events');
|
|
30
28
|
const ErrorHandler = require('./error-handler');
|
|
31
29
|
const SVGSprite = require('./svg-sprite');
|
|
30
|
+
const TerserPlugin = require('terser-webpack-plugin');
|
|
32
31
|
require('resolve-url-loader');
|
|
33
32
|
require('lezer-loader');
|
|
34
33
|
|
|
@@ -282,8 +281,7 @@ class ConfigBuilder {
|
|
|
282
281
|
output: {
|
|
283
282
|
filename: '[name].js',
|
|
284
283
|
// Because we use third party libraries 'chunkFilename' should include only [name]
|
|
285
|
-
chunkFilename: this._getVersionedPath('chunk/[name].js', this.assetVersion)
|
|
286
|
-
crossOriginLoading: "anonymous"
|
|
284
|
+
chunkFilename: this._getVersionedPath('chunk/[name].js', this.assetVersion)
|
|
287
285
|
},
|
|
288
286
|
devtool: !env.skipSourcemap && 'inline-cheap-module-source-map',
|
|
289
287
|
mode: 'development',
|
|
@@ -293,7 +291,20 @@ class ConfigBuilder {
|
|
|
293
291
|
cacheGroups: {
|
|
294
292
|
defaultVendors: false
|
|
295
293
|
}
|
|
296
|
-
}
|
|
294
|
+
},
|
|
295
|
+
minimize: true,
|
|
296
|
+
minimizer: [new TerserPlugin({
|
|
297
|
+
parallel: true,
|
|
298
|
+
extractComments: false,
|
|
299
|
+
minify: TerserPlugin.swcMinify,
|
|
300
|
+
terserOptions: {
|
|
301
|
+
compress: true,
|
|
302
|
+
mangle: true,
|
|
303
|
+
format: {
|
|
304
|
+
comments: false
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
})]
|
|
297
308
|
},
|
|
298
309
|
resolveLoader: {
|
|
299
310
|
modules: [
|
|
@@ -377,8 +388,6 @@ class ConfigBuilder {
|
|
|
377
388
|
new webpack.optimize.MinChunkSizePlugin({
|
|
378
389
|
minChunkSize: 30000 // Minimum number of characters
|
|
379
390
|
}),
|
|
380
|
-
new SubresourceIntegrityPlugin(),
|
|
381
|
-
new IntegrityFilePlugin(),
|
|
382
391
|
new AfterWebpackLogsPlugin(
|
|
383
392
|
stats => this.emitter.emit('build:complete', stats)
|
|
384
393
|
)
|
|
@@ -428,7 +437,10 @@ class ConfigBuilder {
|
|
|
428
437
|
// Additional setting for production mode
|
|
429
438
|
if (this._isProduction) {
|
|
430
439
|
webpackConfig.devtool = false;
|
|
431
|
-
webpackConfig.plugins.push(new CssMinimizerPlugin(
|
|
440
|
+
webpackConfig.plugins.push(new CssMinimizerPlugin({
|
|
441
|
+
parallel: true,
|
|
442
|
+
minify: CssMinimizerPlugin.esbuildMinify
|
|
443
|
+
}));
|
|
432
444
|
}
|
|
433
445
|
|
|
434
446
|
return webpackConfig;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oroinc/oro-webpack-config-builder",
|
|
3
|
-
"version": "6.1.0-
|
|
3
|
+
"version": "6.1.0-lts02",
|
|
4
4
|
"author": "Oro, Inc. (https://oroinc.com)",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "An integration of OroPlatform based applications with the Webpack.",
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
"@babel/core": "~7.23.3",
|
|
10
10
|
"@babel/plugin-transform-runtime": "~7.21.0",
|
|
11
11
|
"@babel/preset-env": "~7.21.2",
|
|
12
|
+
"@swc/core": "^1.11.8",
|
|
12
13
|
"autoprefixer": "~10.4.13",
|
|
13
14
|
"babel-loader": "~9.1.0",
|
|
14
15
|
"bindings": "~1.5.0",
|
|
@@ -17,6 +18,7 @@
|
|
|
17
18
|
"deepmerge": "~4.3.1",
|
|
18
19
|
"exports-loader": "~4.0.0",
|
|
19
20
|
"expose-loader": "~4.1.0",
|
|
21
|
+
"esbuild-loader": "^4.3.0",
|
|
20
22
|
"file-loader": "~6.2.0",
|
|
21
23
|
"html-webpack-plugin": "~5.5.0",
|
|
22
24
|
"imports-loader": "~4.0.1",
|
|
@@ -31,22 +33,22 @@
|
|
|
31
33
|
"printf": "~0.6.0",
|
|
32
34
|
"resolve-url-loader": "^5.0.0",
|
|
33
35
|
"rtlcss-webpack-plugin": "~4.0.6",
|
|
34
|
-
"sass": "~1.
|
|
36
|
+
"sass": "~1.85.0",
|
|
35
37
|
"sass-loader": "~13.2.0",
|
|
36
38
|
"schema-utils": "^4.0.0",
|
|
37
39
|
"style-loader": "~3.3.1",
|
|
38
40
|
"svgo": "^3.0.2",
|
|
39
41
|
"svgstore": "^3.0.1",
|
|
40
|
-
"terser": "~5.
|
|
42
|
+
"terser": "~5.39.0",
|
|
43
|
+
"terser-webpack-plugin": "^5.3.13",
|
|
41
44
|
"text-loader": "0.0.1",
|
|
42
45
|
"underscore": "1.13.*",
|
|
43
46
|
"url-loader": "~4.1.1",
|
|
44
|
-
"webpack": "~5.
|
|
45
|
-
"webpack-bundle-analyzer": "~4.
|
|
46
|
-
"webpack-cli": "~
|
|
47
|
-
"webpack-dev-server": "^
|
|
47
|
+
"webpack": "~5.98.0",
|
|
48
|
+
"webpack-bundle-analyzer": "~4.10.2",
|
|
49
|
+
"webpack-cli": "~6.0.0",
|
|
50
|
+
"webpack-dev-server": "^5.2.0",
|
|
48
51
|
"webpack-merge": "~5.8.0",
|
|
49
|
-
"webpack-subresource-integrity": "^5.2.0-rc.1",
|
|
50
52
|
"wildcard": "~2.0.0"
|
|
51
53
|
}
|
|
52
54
|
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
const { createHash } = require('crypto');
|
|
2
|
-
const { Compilation, sources } = require('webpack');
|
|
3
|
-
const fs = require('fs').promises;
|
|
4
|
-
const path = require('path');
|
|
5
|
-
|
|
6
|
-
class IntegrityFilePlugin {
|
|
7
|
-
constructor({ outputPath = 'integrity.json', algorithm = 'sha384' } = {}) {
|
|
8
|
-
this.outputPath = outputPath;
|
|
9
|
-
this.algorithm = algorithm;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
apply(compiler) {
|
|
13
|
-
compiler.hooks.thisCompilation.tap('IntegrityFilePlugin', (compilation) => {
|
|
14
|
-
compilation.hooks.processAssets.tapPromise(
|
|
15
|
-
{ name: 'SubresourceIntegrityPlugin', stage: Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_TRANSFER },
|
|
16
|
-
async () => {
|
|
17
|
-
const integrityData = Object.fromEntries(
|
|
18
|
-
Object.entries(compilation.assets).map(([assetName, asset]) => {
|
|
19
|
-
const hash = createHash(this.algorithm).update(asset.source()).digest('base64');
|
|
20
|
-
const assetNormalized = assetName.split('?')[0];
|
|
21
|
-
|
|
22
|
-
return [
|
|
23
|
-
path.join(compiler.options.output.publicPath || '', assetNormalized),
|
|
24
|
-
`${this.algorithm}-${hash}`
|
|
25
|
-
];
|
|
26
|
-
})
|
|
27
|
-
);
|
|
28
|
-
|
|
29
|
-
const jsonData = JSON.stringify(integrityData, null, 2);
|
|
30
|
-
await fs.writeFile(this.outputPath, jsonData, 'utf8');
|
|
31
|
-
compilation.emitAsset(this.outputPath, new sources.RawSource(jsonData));
|
|
32
|
-
}
|
|
33
|
-
);
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
module.exports = IntegrityFilePlugin;
|