@workleap/webpack-configs 1.0.2 → 1.0.3
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/CHANGELOG.md +6 -0
- package/dist/build.js +2 -2
- package/dist/{chunk-IGATFK3O.js → chunk-2Q5IGCCY.js} +8 -5
- package/dist/chunk-EF2WO5MC.js +17 -0
- package/dist/{chunk-SBBLJ5AL.js → chunk-EYIS42GE.js} +12 -7
- package/dist/dev.js +2 -2
- package/dist/index.js +3 -3
- package/dist/transformers/applyTransformers.d.ts +1 -0
- package/dist/transformers/applyTransformers.js +1 -1
- package/package.json +3 -3
- package/dist/chunk-URL2KA63.js +0 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @workleap/webpack-configs
|
|
2
2
|
|
|
3
|
+
## 1.0.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#123](https://github.com/gsoft-inc/wl-web-configs/pull/123) [`1c5458f`](https://github.com/gsoft-inc/wl-web-configs/commit/1c5458fba56494648b896e5263addaeb6380848e) Thanks [@patricklafrance](https://github.com/patricklafrance)! - Updated web-configs
|
|
8
|
+
|
|
3
9
|
## 1.0.2
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
package/dist/build.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { defineBuildConfig, defineBuildHtmlWebpackPluginConfig, defineMiniCssExtractPluginConfig } from './chunk-
|
|
2
|
-
import './chunk-
|
|
1
|
+
export { defineBuildConfig, defineBuildHtmlWebpackPluginConfig, defineMiniCssExtractPluginConfig } from './chunk-2Q5IGCCY.js';
|
|
2
|
+
import './chunk-EF2WO5MC.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { applyTransformers } from './chunk-
|
|
1
|
+
import { applyTransformers } from './chunk-EF2WO5MC.js';
|
|
2
2
|
import HtmlWebpackPlugin from 'html-webpack-plugin';
|
|
3
3
|
import MiniCssExtractPlugin from 'mini-css-extract-plugin';
|
|
4
4
|
import { createRequire } from 'node:module';
|
|
@@ -43,7 +43,9 @@ function defineBuildConfig(swcConfig, options = {}) {
|
|
|
43
43
|
miniCssExtractPluginOptions = defineMiniCssExtractPluginConfig(),
|
|
44
44
|
minify = true,
|
|
45
45
|
cssModules = false,
|
|
46
|
-
|
|
46
|
+
// Using an empty object literal as the default value to ensure
|
|
47
|
+
// "process.env" is always available.
|
|
48
|
+
environmentVariables = {},
|
|
47
49
|
transformers = [],
|
|
48
50
|
profile = false
|
|
49
51
|
} = options;
|
|
@@ -67,7 +69,7 @@ function defineBuildConfig(swcConfig, options = {}) {
|
|
|
67
69
|
},
|
|
68
70
|
// Fixes caching for environmental variables using the DefinePlugin by forcing
|
|
69
71
|
// webpack caching to prioritize hashes over timestamps.
|
|
70
|
-
snapshot: {
|
|
72
|
+
snapshot: cache ? {
|
|
71
73
|
buildDependencies: {
|
|
72
74
|
hash: true,
|
|
73
75
|
timestamp: true
|
|
@@ -84,7 +86,7 @@ function defineBuildConfig(swcConfig, options = {}) {
|
|
|
84
86
|
hash: true,
|
|
85
87
|
timestamp: true
|
|
86
88
|
}
|
|
87
|
-
},
|
|
89
|
+
} : void 0,
|
|
88
90
|
optimization: minify ? {
|
|
89
91
|
minimize: true,
|
|
90
92
|
minimizer: [
|
|
@@ -163,7 +165,8 @@ function defineBuildConfig(swcConfig, options = {}) {
|
|
|
163
165
|
].filter(Boolean)
|
|
164
166
|
};
|
|
165
167
|
const transformedConfig = applyTransformers(config, transformers, {
|
|
166
|
-
environment: "build"
|
|
168
|
+
environment: "build",
|
|
169
|
+
profile
|
|
167
170
|
});
|
|
168
171
|
return transformedConfig;
|
|
169
172
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// src/transformers/applyTransformers.ts
|
|
2
|
+
function applyTransformers(config, transformers, context) {
|
|
3
|
+
let count = 0;
|
|
4
|
+
const transformedConfig = transformers.reduce((acc, transformer) => {
|
|
5
|
+
transformer(acc, context);
|
|
6
|
+
count += 1;
|
|
7
|
+
return acc;
|
|
8
|
+
}, config);
|
|
9
|
+
if (context.profile) {
|
|
10
|
+
if (count > 0) {
|
|
11
|
+
console.log(`[webpack-configs] Applied ${count} configuration transformers.`);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
return transformedConfig;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export { applyTransformers };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { isObject } from './chunk-P2Z3EEVF.js';
|
|
2
|
-
import { applyTransformers } from './chunk-
|
|
2
|
+
import { applyTransformers } from './chunk-EF2WO5MC.js';
|
|
3
3
|
import ReactRefreshWebpackPlugin from '@pmmmwh/react-refresh-webpack-plugin';
|
|
4
4
|
import HtmlWebpackPlugin from 'html-webpack-plugin';
|
|
5
5
|
import { createRequire } from 'node:module';
|
|
@@ -53,7 +53,9 @@ function defineDevConfig(swcConfig, options = {}) {
|
|
|
53
53
|
htmlWebpackPlugin = defineDevHtmlWebpackPluginConfig(),
|
|
54
54
|
fastRefresh = true,
|
|
55
55
|
cssModules = false,
|
|
56
|
-
|
|
56
|
+
// Using an empty object literal as the default value to ensure
|
|
57
|
+
// "process.env" is always available.
|
|
58
|
+
environmentVariables = {},
|
|
57
59
|
transformers = [],
|
|
58
60
|
profile = false
|
|
59
61
|
} = options;
|
|
@@ -86,7 +88,7 @@ function defineDevConfig(swcConfig, options = {}) {
|
|
|
86
88
|
},
|
|
87
89
|
// Fixes caching for environmental variables using the DefinePlugin by forcing
|
|
88
90
|
// webpack caching to prioritize hashes over timestamps.
|
|
89
|
-
snapshot: {
|
|
91
|
+
snapshot: cache ? {
|
|
90
92
|
buildDependencies: {
|
|
91
93
|
hash: true,
|
|
92
94
|
timestamp: true
|
|
@@ -103,10 +105,12 @@ function defineDevConfig(swcConfig, options = {}) {
|
|
|
103
105
|
hash: true,
|
|
104
106
|
timestamp: true
|
|
105
107
|
}
|
|
106
|
-
},
|
|
108
|
+
} : void 0,
|
|
109
|
+
// See: https://webpack.js.org/guides/build-performance/#avoid-extra-optimization-steps
|
|
107
110
|
optimization: {
|
|
108
|
-
//
|
|
109
|
-
|
|
111
|
+
// Keep "runtimeChunk" to false, otherwise it breaks module federation
|
|
112
|
+
// (at least for the remote application).
|
|
113
|
+
runtimeChunk: false,
|
|
110
114
|
removeAvailableModules: false,
|
|
111
115
|
removeEmptyChunks: false,
|
|
112
116
|
splitChunks: false
|
|
@@ -177,7 +181,8 @@ function defineDevConfig(swcConfig, options = {}) {
|
|
|
177
181
|
].filter(Boolean)
|
|
178
182
|
};
|
|
179
183
|
const transformedConfig = applyTransformers(config, transformers, {
|
|
180
|
-
environment: "dev"
|
|
184
|
+
environment: "dev",
|
|
185
|
+
profile
|
|
181
186
|
});
|
|
182
187
|
return transformedConfig;
|
|
183
188
|
}
|
package/dist/dev.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { defineDevConfig, defineDevHtmlWebpackPluginConfig, defineFastRefreshPluginConfig } from './chunk-
|
|
1
|
+
export { defineDevConfig, defineDevHtmlWebpackPluginConfig, defineFastRefreshPluginConfig } from './chunk-EYIS42GE.js';
|
|
2
2
|
import './chunk-P2Z3EEVF.js';
|
|
3
|
-
import './chunk-
|
|
3
|
+
import './chunk-EF2WO5MC.js';
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { defineBuildConfig, defineBuildHtmlWebpackPluginConfig, defineMiniCssExtractPluginConfig } from './chunk-
|
|
2
|
-
export { defineDevConfig, defineDevHtmlWebpackPluginConfig, defineFastRefreshPluginConfig } from './chunk-
|
|
1
|
+
export { defineBuildConfig, defineBuildHtmlWebpackPluginConfig, defineMiniCssExtractPluginConfig } from './chunk-2Q5IGCCY.js';
|
|
2
|
+
export { defineDevConfig, defineDevHtmlWebpackPluginConfig, defineFastRefreshPluginConfig } from './chunk-EYIS42GE.js';
|
|
3
3
|
import './chunk-P2Z3EEVF.js';
|
|
4
|
-
import './chunk-
|
|
4
|
+
import './chunk-EF2WO5MC.js';
|
|
5
5
|
export { addAfterModuleRule, addBeforeModuleRule, findModuleRule, findModuleRules, matchAssetModuleType, matchLoaderName, matchTest, removeModuleRules, replaceModuleRule } from './chunk-34O5ZLZ6.js';
|
|
6
6
|
export { addAfterPlugin, addBeforePlugin, findPlugin, matchConstructorName, removePlugin, replacePlugin } from './chunk-JPURRV2F.js';
|
|
@@ -2,6 +2,7 @@ import { Configuration } from 'webpack';
|
|
|
2
2
|
|
|
3
3
|
interface WebpackConfigTransformerContext {
|
|
4
4
|
environment: "dev" | "build";
|
|
5
|
+
profile: boolean;
|
|
5
6
|
}
|
|
6
7
|
type WebpackConfigTransformer = (config: Configuration, context: WebpackConfigTransformerContext) => Configuration;
|
|
7
8
|
declare function applyTransformers(config: Configuration, transformers: WebpackConfigTransformer[], context: WebpackConfigTransformerContext): Configuration;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { applyTransformers } from '../chunk-
|
|
1
|
+
export { applyTransformers } from '../chunk-EF2WO5MC.js';
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@workleap/webpack-configs",
|
|
3
3
|
"author": "Workleap",
|
|
4
4
|
"description": "Workleap recommended webpack config.",
|
|
5
|
-
"version": "1.0.
|
|
5
|
+
"version": "1.0.3",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"keywords": [
|
|
8
8
|
"workleap",
|
|
@@ -66,9 +66,9 @@
|
|
|
66
66
|
"webpack": "5.88.2",
|
|
67
67
|
"webpack-dev-server": "4.15.1",
|
|
68
68
|
"@workleap/eslint-plugin": "2.1.0",
|
|
69
|
-
"@workleap/swc-configs": "2.1.1",
|
|
70
69
|
"@workleap/tsup-configs": "3.0.0",
|
|
71
|
-
"@workleap/typescript-configs": "3.0.2"
|
|
70
|
+
"@workleap/typescript-configs": "3.0.2",
|
|
71
|
+
"@workleap/swc-configs": "2.1.1"
|
|
72
72
|
},
|
|
73
73
|
"publishConfig": {
|
|
74
74
|
"access": "public",
|