@workleap/webpack-configs 1.0.4 → 1.0.6
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 +12 -0
- package/dist/build.d.ts +1 -1
- package/dist/build.js +2 -2
- package/dist/{chunk-NQR5SLK3.js → chunk-FXES4JZF.js} +12 -8
- package/dist/{chunk-EF2WO5MC.js → chunk-QJI26K46.js} +1 -1
- package/dist/{chunk-IAMDZMFH.js → chunk-ZBXE4VAX.js} +6 -15
- package/dist/dev.d.ts +1 -1
- package/dist/dev.js +2 -2
- package/dist/index.js +3 -3
- package/dist/transformers/applyTransformers.d.ts +1 -1
- package/dist/transformers/applyTransformers.js +1 -1
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @workleap/webpack-configs
|
|
2
2
|
|
|
3
|
+
## 1.0.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#135](https://github.com/gsoft-inc/wl-web-configs/pull/135) [`0b36530`](https://github.com/gsoft-inc/wl-web-configs/commit/0b365307c97c4f1ef9c7ced8867a3bf103223c7a) Thanks [@patricklafrance](https://github.com/patricklafrance)! - Release webpack-configs
|
|
8
|
+
|
|
9
|
+
## 1.0.5
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#131](https://github.com/gsoft-inc/wl-web-configs/pull/131) [`11bb287`](https://github.com/gsoft-inc/wl-web-configs/commit/11bb287847b4f525faa83abd23e46c56f58e41f4) Thanks [@patricklafrance](https://github.com/patricklafrance)! - Added a default key to exports
|
|
14
|
+
|
|
3
15
|
## 1.0.4
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/dist/build.d.ts
CHANGED
|
@@ -21,7 +21,7 @@ interface DefineBuildConfigOptions {
|
|
|
21
21
|
cssModules?: boolean;
|
|
22
22
|
environmentVariables?: Record<string, unknown>;
|
|
23
23
|
transformers?: WebpackConfigTransformer[];
|
|
24
|
-
|
|
24
|
+
verbose?: boolean;
|
|
25
25
|
}
|
|
26
26
|
declare function defineBuildConfig(swcConfig: Config, options?: DefineBuildConfigOptions): Configuration;
|
|
27
27
|
|
package/dist/build.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { defineBuildConfig, defineBuildHtmlWebpackPluginConfig, defineMiniCssExtractPluginConfig } from './chunk-
|
|
1
|
+
export { defineBuildConfig, defineBuildHtmlWebpackPluginConfig, defineMiniCssExtractPluginConfig } from './chunk-FXES4JZF.js';
|
|
2
2
|
import './chunk-P2Z3EEVF.js';
|
|
3
|
-
import './chunk-
|
|
3
|
+
import './chunk-QJI26K46.js';
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { isObject } from './chunk-P2Z3EEVF.js';
|
|
2
|
-
import { applyTransformers } from './chunk-
|
|
2
|
+
import { applyTransformers } from './chunk-QJI26K46.js';
|
|
3
3
|
import HtmlWebpackPlugin from 'html-webpack-plugin';
|
|
4
4
|
import MiniCssExtractPlugin from 'mini-css-extract-plugin';
|
|
5
5
|
import { createRequire } from 'node:module';
|
|
6
6
|
import path from 'node:path';
|
|
7
|
-
import { fileURLToPath } from 'node:url';
|
|
8
7
|
import TerserPlugin from 'terser-webpack-plugin';
|
|
9
8
|
import webpack from 'webpack';
|
|
10
9
|
|
|
@@ -30,7 +29,15 @@ function defineMiniCssExtractPluginConfig(options = {}) {
|
|
|
30
29
|
filename
|
|
31
30
|
};
|
|
32
31
|
}
|
|
32
|
+
function preflight(options) {
|
|
33
|
+
if (options.publicPath) {
|
|
34
|
+
if (!options.publicPath.endsWith("/")) {
|
|
35
|
+
throw new Error('[webpack-configs] The "publicPath" must end with a "/".');
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
33
39
|
function defineBuildConfig(swcConfig, options = {}) {
|
|
40
|
+
preflight(options);
|
|
34
41
|
const {
|
|
35
42
|
entry = path.resolve("./src/index.tsx"),
|
|
36
43
|
outputPath = path.resolve("dist"),
|
|
@@ -48,7 +55,7 @@ function defineBuildConfig(swcConfig, options = {}) {
|
|
|
48
55
|
// "process.env" is always available.
|
|
49
56
|
environmentVariables = {},
|
|
50
57
|
transformers = [],
|
|
51
|
-
|
|
58
|
+
verbose = false
|
|
52
59
|
} = options;
|
|
53
60
|
const config = {
|
|
54
61
|
mode: "production",
|
|
@@ -63,9 +70,6 @@ function defineBuildConfig(swcConfig, options = {}) {
|
|
|
63
70
|
cache: cache && {
|
|
64
71
|
type: "filesystem",
|
|
65
72
|
allowCollectingMemory: false,
|
|
66
|
-
buildDependencies: {
|
|
67
|
-
config: [fileURLToPath(import.meta.url)]
|
|
68
|
-
},
|
|
69
73
|
cacheDirectory
|
|
70
74
|
},
|
|
71
75
|
// Fixes caching for environmental variables using the DefinePlugin by forcing
|
|
@@ -100,7 +104,7 @@ function defineBuildConfig(swcConfig, options = {}) {
|
|
|
100
104
|
})
|
|
101
105
|
]
|
|
102
106
|
} : void 0,
|
|
103
|
-
infrastructureLogging:
|
|
107
|
+
infrastructureLogging: verbose ? {
|
|
104
108
|
appendOnly: true,
|
|
105
109
|
level: "verbose",
|
|
106
110
|
debug: /PackFileCache/
|
|
@@ -172,7 +176,7 @@ function defineBuildConfig(swcConfig, options = {}) {
|
|
|
172
176
|
};
|
|
173
177
|
const transformedConfig = applyTransformers(config, transformers, {
|
|
174
178
|
environment: "build",
|
|
175
|
-
|
|
179
|
+
verbose
|
|
176
180
|
});
|
|
177
181
|
return transformedConfig;
|
|
178
182
|
}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { isObject } from './chunk-P2Z3EEVF.js';
|
|
2
|
-
import { applyTransformers } from './chunk-
|
|
2
|
+
import { applyTransformers } from './chunk-QJI26K46.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';
|
|
6
6
|
import path from 'node:path';
|
|
7
|
-
import { fileURLToPath } from 'node:url';
|
|
8
7
|
import webpack from 'webpack';
|
|
9
8
|
import 'webpack-dev-server';
|
|
10
9
|
|
|
@@ -23,15 +22,10 @@ function defineDevHtmlWebpackPluginConfig(options = {}) {
|
|
|
23
22
|
function defineFastRefreshPluginConfig(options = {}) {
|
|
24
23
|
return options;
|
|
25
24
|
}
|
|
26
|
-
function preflight(
|
|
25
|
+
function preflight() {
|
|
27
26
|
if (!require2.resolve("webpack-dev-server")) {
|
|
28
27
|
throw new Error('[webpack-configs] To use the "dev" config, install https://www.npmjs.com/package/webpack-dev-server as a "devDependency".');
|
|
29
28
|
}
|
|
30
|
-
if (options.fastRefresh) {
|
|
31
|
-
if (!require2.resolve("@pmmmwh/react-refresh-webpack-plugin")) {
|
|
32
|
-
throw new Error('[webpack-configs] To use Webpack Fast Refresh, install https://www.npmjs.com/package/@pmmmwh/react-refresh-webpack-plugin as a "devDependency".');
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
29
|
}
|
|
36
30
|
function trySetSwcFastRefresh(config, enabled) {
|
|
37
31
|
if (config?.jsc?.transform?.react) {
|
|
@@ -40,7 +34,7 @@ function trySetSwcFastRefresh(config, enabled) {
|
|
|
40
34
|
return config;
|
|
41
35
|
}
|
|
42
36
|
function defineDevConfig(swcConfig, options = {}) {
|
|
43
|
-
preflight(
|
|
37
|
+
preflight();
|
|
44
38
|
const {
|
|
45
39
|
entry = path.resolve("./src/index.tsx"),
|
|
46
40
|
https = false,
|
|
@@ -57,7 +51,7 @@ function defineDevConfig(swcConfig, options = {}) {
|
|
|
57
51
|
// "process.env" is always available.
|
|
58
52
|
environmentVariables = {},
|
|
59
53
|
transformers = [],
|
|
60
|
-
|
|
54
|
+
verbose = false
|
|
61
55
|
} = options;
|
|
62
56
|
const config = {
|
|
63
57
|
mode: "development",
|
|
@@ -81,9 +75,6 @@ function defineDevConfig(swcConfig, options = {}) {
|
|
|
81
75
|
type: "filesystem",
|
|
82
76
|
allowCollectingMemory: true,
|
|
83
77
|
maxMemoryGenerations: 1,
|
|
84
|
-
buildDependencies: {
|
|
85
|
-
config: [fileURLToPath(import.meta.url)]
|
|
86
|
-
},
|
|
87
78
|
cacheDirectory
|
|
88
79
|
},
|
|
89
80
|
// Fixes caching for environmental variables using the DefinePlugin by forcing
|
|
@@ -115,7 +106,7 @@ function defineDevConfig(swcConfig, options = {}) {
|
|
|
115
106
|
removeEmptyChunks: false,
|
|
116
107
|
splitChunks: false
|
|
117
108
|
},
|
|
118
|
-
infrastructureLogging:
|
|
109
|
+
infrastructureLogging: verbose ? {
|
|
119
110
|
appendOnly: true,
|
|
120
111
|
level: "verbose",
|
|
121
112
|
debug: /PackFileCache/
|
|
@@ -187,7 +178,7 @@ function defineDevConfig(swcConfig, options = {}) {
|
|
|
187
178
|
};
|
|
188
179
|
const transformedConfig = applyTransformers(config, transformers, {
|
|
189
180
|
environment: "dev",
|
|
190
|
-
|
|
181
|
+
verbose
|
|
191
182
|
});
|
|
192
183
|
return transformedConfig;
|
|
193
184
|
}
|
package/dist/dev.d.ts
CHANGED
|
@@ -20,7 +20,7 @@ interface DefineDevConfigOptions {
|
|
|
20
20
|
cssModules?: boolean;
|
|
21
21
|
environmentVariables?: Record<string, unknown>;
|
|
22
22
|
transformers?: WebpackConfigTransformer[];
|
|
23
|
-
|
|
23
|
+
verbose?: boolean;
|
|
24
24
|
}
|
|
25
25
|
declare function defineDevConfig(swcConfig: Config, options?: DefineDevConfigOptions): Configuration;
|
|
26
26
|
|
package/dist/dev.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { defineDevConfig, defineDevHtmlWebpackPluginConfig, defineFastRefreshPluginConfig } from './chunk-
|
|
1
|
+
export { defineDevConfig, defineDevHtmlWebpackPluginConfig, defineFastRefreshPluginConfig } from './chunk-ZBXE4VAX.js';
|
|
2
2
|
import './chunk-P2Z3EEVF.js';
|
|
3
|
-
import './chunk-
|
|
3
|
+
import './chunk-QJI26K46.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-FXES4JZF.js';
|
|
2
|
+
export { defineDevConfig, defineDevHtmlWebpackPluginConfig, defineFastRefreshPluginConfig } from './chunk-ZBXE4VAX.js';
|
|
3
3
|
import './chunk-P2Z3EEVF.js';
|
|
4
|
-
import './chunk-
|
|
4
|
+
import './chunk-QJI26K46.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,7 +2,7 @@ import { Configuration } from 'webpack';
|
|
|
2
2
|
|
|
3
3
|
interface WebpackConfigTransformerContext {
|
|
4
4
|
environment: "dev" | "build";
|
|
5
|
-
|
|
5
|
+
verbose: boolean;
|
|
6
6
|
}
|
|
7
7
|
type WebpackConfigTransformer = (config: Configuration, context: WebpackConfigTransformerContext) => Configuration;
|
|
8
8
|
declare function applyTransformers(config: Configuration, transformers: WebpackConfigTransformer[], context: WebpackConfigTransformerContext): Configuration;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { applyTransformers } from '../chunk-
|
|
1
|
+
export { applyTransformers } from '../chunk-QJI26K46.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.6",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"keywords": [
|
|
8
8
|
"workleap",
|
|
@@ -13,7 +13,8 @@
|
|
|
13
13
|
"exports": {
|
|
14
14
|
".": {
|
|
15
15
|
"import": "./dist/index.js",
|
|
16
|
-
"types": "./dist/index.d.ts"
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
17
|
+
"default": "./dist/index.js"
|
|
17
18
|
}
|
|
18
19
|
},
|
|
19
20
|
"files": [
|
|
@@ -28,6 +29,7 @@
|
|
|
28
29
|
},
|
|
29
30
|
"dependencies": {
|
|
30
31
|
"@pmmmwh/react-refresh-webpack-plugin": "0.5.11",
|
|
32
|
+
"@svgr/webpack": "8.1.0",
|
|
31
33
|
"css-loader": "6.8.1",
|
|
32
34
|
"html-webpack-plugin": "5.5.3",
|
|
33
35
|
"mini-css-extract-plugin": "2.7.6",
|
|
@@ -37,13 +39,12 @@
|
|
|
37
39
|
"terser-webpack-plugin": "5.3.9"
|
|
38
40
|
},
|
|
39
41
|
"peerDependencies": {
|
|
40
|
-
"@svgr/webpack": "*",
|
|
41
42
|
"@swc/core": "*",
|
|
42
43
|
"@swc/helpers": "*",
|
|
43
44
|
"browserslist": "*",
|
|
44
45
|
"postcss": "*",
|
|
45
|
-
"webpack": "
|
|
46
|
-
"webpack-dev-server": "
|
|
46
|
+
"webpack": ">=5.0.0",
|
|
47
|
+
"webpack-dev-server": ">=4.0.0"
|
|
47
48
|
},
|
|
48
49
|
"peerDependenciesMeta": {
|
|
49
50
|
"webpack-dev-server": {
|
|
@@ -51,7 +52,6 @@
|
|
|
51
52
|
}
|
|
52
53
|
},
|
|
53
54
|
"devDependencies": {
|
|
54
|
-
"@svgr/webpack": "8.1.0",
|
|
55
55
|
"@swc/core": "1.3.82",
|
|
56
56
|
"@swc/helpers": "0.5.1",
|
|
57
57
|
"@swc/jest": "0.2.29",
|
|
@@ -68,8 +68,8 @@
|
|
|
68
68
|
"webpack-dev-server": "4.15.1",
|
|
69
69
|
"@workleap/eslint-plugin": "2.1.0",
|
|
70
70
|
"@workleap/swc-configs": "2.1.1",
|
|
71
|
-
"@workleap/
|
|
72
|
-
"@workleap/
|
|
71
|
+
"@workleap/tsup-configs": "3.0.0",
|
|
72
|
+
"@workleap/typescript-configs": "3.0.2"
|
|
73
73
|
},
|
|
74
74
|
"publishConfig": {
|
|
75
75
|
"access": "public",
|