@workleap/webpack-configs 1.5.2 → 1.5.4
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 +35 -23
- package/README.md +2 -2
- package/dist/build.d.ts +18 -19
- package/dist/build.js +219 -3
- package/dist/build.js.map +1 -0
- package/dist/dev.d.ts +16 -17
- package/dist/dev.js +208 -3
- package/dist/dev.js.map +1 -0
- package/dist/index.d.ts +6 -12
- package/dist/index.js +15 -7
- package/dist/index.js.map +1 -0
- package/dist/transformers/applyTransformers.d.ts +4 -7
- package/dist/transformers/applyTransformers.js +20 -1
- package/dist/transformers/applyTransformers.js.map +1 -0
- package/dist/transformers/moduleRules.d.ts +15 -17
- package/dist/transformers/moduleRules.js +166 -1
- package/dist/transformers/moduleRules.js.map +1 -0
- package/dist/transformers/plugins.d.ts +11 -14
- package/dist/transformers/plugins.js +69 -1
- package/dist/transformers/plugins.js.map +1 -0
- package/dist/types.d.ts +1 -1
- package/dist/types.js +6 -1
- package/dist/types.js.map +1 -0
- package/dist/utils.d.ts +4 -6
- package/dist/utils.js +22 -1
- package/dist/utils.js.map +1 -0
- package/package.json +21 -24
- package/src/build.ts +240 -0
- package/src/dev.ts +233 -0
- package/src/index.ts +7 -0
- package/src/transformers/applyTransformers.ts +28 -0
- package/src/transformers/moduleRules.ts +229 -0
- package/src/transformers/plugins.ts +102 -0
- package/src/types.ts +1 -0
- package/src/utils.ts +19 -0
- package/dist/chunk-2YARCRX5.js +0 -15
- package/dist/chunk-34O5ZLZ6.js +0 -154
- package/dist/chunk-5ACA7GOB.js +0 -17
- package/dist/chunk-6F4PWJZI.js +0 -1
- package/dist/chunk-CW54GSNS.js +0 -197
- package/dist/chunk-JPURRV2F.js +0 -71
- package/dist/chunk-JU2EHEXW.js +0 -186
package/CHANGELOG.md
CHANGED
|
@@ -1,140 +1,152 @@
|
|
|
1
1
|
# @workleap/webpack-configs
|
|
2
2
|
|
|
3
|
+
## 1.5.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#242](https://github.com/workleap/wl-web-configs/pull/242) [`e165cb4`](https://github.com/workleap/wl-web-configs/commit/e165cb447e699e19f06d41532216e36c09d7b945) Thanks [@patricklafrance](https://github.com/patricklafrance)! - Updated dependencies.
|
|
8
|
+
|
|
9
|
+
## 1.5.3
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#230](https://github.com/workleap/wl-web-configs/pull/230) [`0a4279c`](https://github.com/workleap/wl-web-configs/commit/0a4279c40b7c2ea76c7e1884a8e2fd744ca9b7c1) Thanks [@patricklafrance](https://github.com/patricklafrance)! - Packages now includes the source codes and sourcemap.
|
|
14
|
+
|
|
3
15
|
## 1.5.2
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
6
18
|
|
|
7
|
-
- [#215](https://github.com/
|
|
19
|
+
- [#215](https://github.com/workleap/wl-web-configs/pull/215) [`d6dfe8f`](https://github.com/workleap/wl-web-configs/commit/d6dfe8f61ab56a606c84c7c580dded75ba5e7bfc) Thanks [@patricklafrance](https://github.com/patricklafrance)! - Fixed typings.
|
|
8
20
|
|
|
9
21
|
## 1.5.1
|
|
10
22
|
|
|
11
23
|
### Patch Changes
|
|
12
24
|
|
|
13
|
-
- [#201](https://github.com/
|
|
25
|
+
- [#201](https://github.com/workleap/wl-web-configs/pull/201) [`de5804b`](https://github.com/workleap/wl-web-configs/commit/de5804b352496fe0a6d4e01a5b6bb5e6a56aca18) Thanks [@bsokol-wl](https://github.com/bsokol-wl)! - Remove hashes from chunk file names and asset/resource file names in order to prevent chunk load errors for users during a deployment
|
|
14
26
|
|
|
15
27
|
## 1.5.0
|
|
16
28
|
|
|
17
29
|
### Minor Changes
|
|
18
30
|
|
|
19
|
-
- [#190](https://github.com/
|
|
31
|
+
- [#190](https://github.com/workleap/wl-web-configs/pull/190) [`b6246b3`](https://github.com/workleap/wl-web-configs/commit/b6246b30a505821e36b09579fb14e3c0f99c963a) Thanks [@bsokol-wl](https://github.com/bsokol-wl)! - Enable in-memory webpack cache by default
|
|
20
32
|
|
|
21
33
|
## 1.4.2
|
|
22
34
|
|
|
23
35
|
### Patch Changes
|
|
24
36
|
|
|
25
|
-
- [#188](https://github.com/
|
|
37
|
+
- [#188](https://github.com/workleap/wl-web-configs/pull/188) [`37b6253`](https://github.com/workleap/wl-web-configs/commit/37b625375848907b34a5c86bd95de69b25a5342f) Thanks [@patricklafrance](https://github.com/patricklafrance)! - Updated dependencies.
|
|
26
38
|
|
|
27
39
|
## 1.4.1
|
|
28
40
|
|
|
29
41
|
### Patch Changes
|
|
30
42
|
|
|
31
|
-
- [#186](https://github.com/
|
|
43
|
+
- [#186](https://github.com/workleap/wl-web-configs/pull/186) [`997054e`](https://github.com/workleap/wl-web-configs/commit/997054eb66118e5897ce686a446d98ac7ea6abd6) Thanks [@patricklafrance](https://github.com/patricklafrance)! - Loosen the dependencies version.
|
|
32
44
|
|
|
33
45
|
## 1.4.0
|
|
34
46
|
|
|
35
47
|
### Minor Changes
|
|
36
48
|
|
|
37
|
-
- [#183](https://github.com/
|
|
49
|
+
- [#183](https://github.com/workleap/wl-web-configs/pull/183) [`77128e6`](https://github.com/workleap/wl-web-configs/commit/77128e666574333035e6bb077fc1982f327751eb) Thanks [@patricklafrance](https://github.com/patricklafrance)! - Added a "readable" option to Webpack optimize option.
|
|
38
50
|
|
|
39
51
|
## 1.3.2
|
|
40
52
|
|
|
41
53
|
### Patch Changes
|
|
42
54
|
|
|
43
|
-
- [#179](https://github.com/
|
|
55
|
+
- [#179](https://github.com/workleap/wl-web-configs/pull/179) [`61d3721`](https://github.com/workleap/wl-web-configs/commit/61d37216198083ba78cd4b1480e38c8d772a6119) Thanks [@patricklafrance](https://github.com/patricklafrance)! - Updated dependencies.
|
|
44
56
|
|
|
45
57
|
## 1.3.1
|
|
46
58
|
|
|
47
59
|
### Patch Changes
|
|
48
60
|
|
|
49
|
-
- [#177](https://github.com/
|
|
61
|
+
- [#177](https://github.com/workleap/wl-web-configs/pull/177) [`8936ce6`](https://github.com/workleap/wl-web-configs/commit/8936ce677cad205caba2f13a71f5c9208f1dd5e6) Thanks [@patricklafrance](https://github.com/patricklafrance)! - Updated packages dependencies.
|
|
50
62
|
|
|
51
63
|
## 1.3.0
|
|
52
64
|
|
|
53
65
|
### Minor Changes
|
|
54
66
|
|
|
55
|
-
- [#175](https://github.com/
|
|
67
|
+
- [#175](https://github.com/workleap/wl-web-configs/pull/175) [`0f5077c`](https://github.com/workleap/wl-web-configs/commit/0f5077cdc9592e02099c498fcb6ebda6e1637e0c) Thanks [@patricklafrance](https://github.com/patricklafrance)! - Added an `svgr` option.
|
|
56
68
|
|
|
57
69
|
## 1.2.1
|
|
58
70
|
|
|
59
71
|
### Patch Changes
|
|
60
72
|
|
|
61
|
-
- [#167](https://github.com/
|
|
73
|
+
- [#167](https://github.com/workleap/wl-web-configs/pull/167) [`55e0bd4`](https://github.com/workleap/wl-web-configs/commit/55e0bd4a7574f3cc6c138474eca90b84a62ad16f) Thanks [@tjosepo](https://github.com/tjosepo)! - Fix file extension RegEx rules being too lenient
|
|
62
74
|
|
|
63
75
|
## 1.2.0
|
|
64
76
|
|
|
65
77
|
### Minor Changes
|
|
66
78
|
|
|
67
|
-
- [#164](https://github.com/
|
|
79
|
+
- [#164](https://github.com/workleap/wl-web-configs/pull/164) [`b747f5b`](https://github.com/workleap/wl-web-configs/commit/b747f5b1d1bc7f0b7935e04ab971dad256e8ed8c) Thanks [@patricklafrance](https://github.com/patricklafrance)! - - Added a `publicPath` prop to the development configuration.
|
|
68
80
|
|
|
69
81
|
## 1.1.1
|
|
70
82
|
|
|
71
83
|
### Patch Changes
|
|
72
84
|
|
|
73
|
-
- [#162](https://github.com/
|
|
85
|
+
- [#162](https://github.com/workleap/wl-web-configs/pull/162) [`fff9d08`](https://github.com/workleap/wl-web-configs/commit/fff9d087ebfe941fb38de8a46b3af79258f7f80d) Thanks [@patricklafrance](https://github.com/patricklafrance)! - - Removed the `build` config `preflight` function because it's not enforced by TypeScript typings.
|
|
74
86
|
- Updated the `build` config non-optimized options.
|
|
75
87
|
|
|
76
88
|
## 1.1.0
|
|
77
89
|
|
|
78
90
|
### Minor Changes
|
|
79
91
|
|
|
80
|
-
- [#155](https://github.com/
|
|
92
|
+
- [#155](https://github.com/workleap/wl-web-configs/pull/155) [`5a02365`](https://github.com/workleap/wl-web-configs/commit/5a02365e18b002c48c20e4ae23114d7063027b2f) Thanks [@patricklafrance](https://github.com/patricklafrance)! - Added an overlay predefined options for the webpack config.
|
|
81
93
|
|
|
82
94
|
## 1.0.8
|
|
83
95
|
|
|
84
96
|
### Patch Changes
|
|
85
97
|
|
|
86
|
-
- [#146](https://github.com/
|
|
98
|
+
- [#146](https://github.com/workleap/wl-web-configs/pull/146) [`0b259b0`](https://github.com/workleap/wl-web-configs/commit/0b259b0849e32c49f78be2f9869a5daea0b4c6f3) Thanks [@patricklafrance](https://github.com/patricklafrance)! - Replaced build option "minify" for "optimize"
|
|
87
99
|
|
|
88
100
|
## 1.0.7
|
|
89
101
|
|
|
90
102
|
### Patch Changes
|
|
91
103
|
|
|
92
|
-
- [#143](https://github.com/
|
|
104
|
+
- [#143](https://github.com/workleap/wl-web-configs/pull/143) [`334088f`](https://github.com/workleap/wl-web-configs/commit/334088fac63aad6cc245ee3300da076e5c201287) Thanks [@patricklafrance](https://github.com/patricklafrance)! - Updated to SWC 1.3.85
|
|
93
105
|
|
|
94
106
|
## 1.0.6
|
|
95
107
|
|
|
96
108
|
### Patch Changes
|
|
97
109
|
|
|
98
|
-
- [#135](https://github.com/
|
|
110
|
+
- [#135](https://github.com/workleap/wl-web-configs/pull/135) [`0b36530`](https://github.com/workleap/wl-web-configs/commit/0b365307c97c4f1ef9c7ced8867a3bf103223c7a) Thanks [@patricklafrance](https://github.com/patricklafrance)! - Release webpack-configs
|
|
99
111
|
|
|
100
112
|
## 1.0.5
|
|
101
113
|
|
|
102
114
|
### Patch Changes
|
|
103
115
|
|
|
104
|
-
- [#131](https://github.com/
|
|
116
|
+
- [#131](https://github.com/workleap/wl-web-configs/pull/131) [`11bb287`](https://github.com/workleap/wl-web-configs/commit/11bb287847b4f525faa83abd23e46c56f58e41f4) Thanks [@patricklafrance](https://github.com/patricklafrance)! - Added a default key to exports
|
|
105
117
|
|
|
106
118
|
## 1.0.4
|
|
107
119
|
|
|
108
120
|
### Patch Changes
|
|
109
121
|
|
|
110
|
-
- [#127](https://github.com/
|
|
122
|
+
- [#127](https://github.com/workleap/wl-web-configs/pull/127) [`f440b12`](https://github.com/workleap/wl-web-configs/commit/f440b1251e2b3c1960dfc7f68bd090f573ec67d6) Thanks [@patricklafrance](https://github.com/patricklafrance)! - Fix environment variables
|
|
111
123
|
|
|
112
124
|
## 1.0.3
|
|
113
125
|
|
|
114
126
|
### Patch Changes
|
|
115
127
|
|
|
116
|
-
- [#123](https://github.com/
|
|
128
|
+
- [#123](https://github.com/workleap/wl-web-configs/pull/123) [`1c5458f`](https://github.com/workleap/wl-web-configs/commit/1c5458fba56494648b896e5263addaeb6380848e) Thanks [@patricklafrance](https://github.com/patricklafrance)! - Updated web-configs
|
|
117
129
|
|
|
118
130
|
## 1.0.2
|
|
119
131
|
|
|
120
132
|
### Patch Changes
|
|
121
133
|
|
|
122
|
-
- [#120](https://github.com/
|
|
134
|
+
- [#120](https://github.com/workleap/wl-web-configs/pull/120) [`0e66000`](https://github.com/workleap/wl-web-configs/commit/0e66000b2028cad9c606d3523e3bcf540e6350e2) Thanks [@patricklafrance](https://github.com/patricklafrance)! - Updated configs
|
|
123
135
|
|
|
124
136
|
## 1.0.1
|
|
125
137
|
|
|
126
138
|
### Patch Changes
|
|
127
139
|
|
|
128
|
-
- [#116](https://github.com/
|
|
140
|
+
- [#116](https://github.com/workleap/wl-web-configs/pull/116) [`5d7f448`](https://github.com/workleap/wl-web-configs/commit/5d7f4486b80f397efb59361935c8e944fcd00d97) Thanks [@patricklafrance](https://github.com/patricklafrance)! - Move fast-refresh package to a dependency rather than an optional peerDependency and move webpack config swcConfig as the first param
|
|
129
141
|
|
|
130
142
|
## 1.0.0
|
|
131
143
|
|
|
132
144
|
### Major Changes
|
|
133
145
|
|
|
134
|
-
- [#98](https://github.com/
|
|
146
|
+
- [#98](https://github.com/workleap/wl-web-configs/pull/98) [`56ca32e`](https://github.com/workleap/wl-web-configs/commit/56ca32ee3194c51210aacc5189f3ebbec5a4a7b6) Thanks [@patricklafrance](https://github.com/patricklafrance)! - New start, every package has a major version bump
|
|
135
147
|
|
|
136
148
|
## 0.0.2
|
|
137
149
|
|
|
138
150
|
### Patch Changes
|
|
139
151
|
|
|
140
|
-
- [#92](https://github.com/
|
|
152
|
+
- [#92](https://github.com/workleap/wl-web-configs/pull/92) [`66e8f10`](https://github.com/workleap/wl-web-configs/commit/66e8f1033a987523c65fe9e61f53dac6d2e38777) Thanks [@ofrogon](https://github.com/ofrogon)! - Migrate project from GitHub organization
|
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
## Usage
|
|
7
7
|
|
|
8
|
-
View the [user's documentation](https://
|
|
8
|
+
View the [user's documentation](https://workleap.github.io/wl-web-configs/).
|
|
9
9
|
|
|
10
10
|
## 🤝 Contributing
|
|
11
11
|
|
|
@@ -19,4 +19,4 @@ To work properly, all projects having React/JSX code that are referenced by the
|
|
|
19
19
|
|
|
20
20
|
## License
|
|
21
21
|
|
|
22
|
-
Copyright © 2023, Workleap. This code is licensed under the Apache License, Version 2.0. You may obtain a copy of this license at https://github.com/
|
|
22
|
+
Copyright © 2023, Workleap. This code is licensed under the Apache License, Version 2.0. You may obtain a copy of this license at https://github.com/workleap/workleap-license/blob/master/LICENSE.
|
package/dist/build.d.ts
CHANGED
|
@@ -1,31 +1,30 @@
|
|
|
1
|
-
import { Config } from
|
|
2
|
-
import { Config as
|
|
3
|
-
import HtmlWebpackPlugin from
|
|
4
|
-
import MiniCssExtractPlugin from
|
|
5
|
-
import webpack
|
|
6
|
-
import { WebpackConfigTransformer } from
|
|
7
|
-
|
|
8
|
-
declare function defineBuildHtmlWebpackPluginConfig(options?: HtmlWebpackPlugin.Options): HtmlWebpackPlugin.Options;
|
|
1
|
+
import type { Config as SvgrOptions } from "@svgr/core";
|
|
2
|
+
import type { Config as SwcConfig } from "@swc/core";
|
|
3
|
+
import HtmlWebpackPlugin from "html-webpack-plugin";
|
|
4
|
+
import MiniCssExtractPlugin from "mini-css-extract-plugin";
|
|
5
|
+
import webpack from "webpack";
|
|
6
|
+
import { type WebpackConfigTransformer } from "./transformers/applyTransformers.ts";
|
|
7
|
+
import type { WebpackConfig } from "./types.ts";
|
|
8
|
+
export declare function defineBuildHtmlWebpackPluginConfig(options?: HtmlWebpackPlugin.Options): HtmlWebpackPlugin.Options;
|
|
9
9
|
type MiniCssExtractPluginOptions = NonNullable<ConstructorParameters<typeof MiniCssExtractPlugin>[number]>;
|
|
10
|
-
declare function defineMiniCssExtractPluginConfig(options?: MiniCssExtractPluginOptions): MiniCssExtractPluginOptions;
|
|
11
|
-
type WebpackOptimization = NonNullable<
|
|
12
|
-
type OptimizeOption = boolean | "readable";
|
|
13
|
-
declare function getOptimizationConfig(optimize: OptimizeOption): WebpackOptimization;
|
|
14
|
-
interface DefineBuildConfigOptions {
|
|
10
|
+
export declare function defineMiniCssExtractPluginConfig(options?: MiniCssExtractPluginOptions): MiniCssExtractPluginOptions;
|
|
11
|
+
export type WebpackOptimization = NonNullable<WebpackConfig["optimization"]>;
|
|
12
|
+
export type OptimizeOption = boolean | "readable";
|
|
13
|
+
export declare function getOptimizationConfig(optimize: OptimizeOption): WebpackOptimization;
|
|
14
|
+
export interface DefineBuildConfigOptions {
|
|
15
15
|
entry?: string;
|
|
16
16
|
outputPath?: string;
|
|
17
17
|
publicPath?: `${string}/` | "auto";
|
|
18
|
-
moduleRules?: NonNullable<
|
|
19
|
-
plugins?:
|
|
18
|
+
moduleRules?: NonNullable<WebpackConfig["module"]>["rules"];
|
|
19
|
+
plugins?: WebpackConfig["plugins"];
|
|
20
20
|
htmlWebpackPlugin?: boolean | HtmlWebpackPlugin.Options;
|
|
21
21
|
miniCssExtractPluginOptions?: MiniCssExtractPluginOptions;
|
|
22
22
|
optimize?: OptimizeOption;
|
|
23
23
|
cssModules?: boolean;
|
|
24
|
-
svgr?: boolean |
|
|
24
|
+
svgr?: boolean | SvgrOptions;
|
|
25
25
|
environmentVariables?: Record<string, unknown>;
|
|
26
26
|
transformers?: WebpackConfigTransformer[];
|
|
27
27
|
verbose?: boolean;
|
|
28
28
|
}
|
|
29
|
-
declare function defineBuildConfig(swcConfig:
|
|
30
|
-
|
|
31
|
-
export { type DefineBuildConfigOptions, type OptimizeOption, type WebpackOptimization, defineBuildConfig, defineBuildHtmlWebpackPluginConfig, defineMiniCssExtractPluginConfig, getOptimizationConfig };
|
|
29
|
+
export declare function defineBuildConfig(swcConfig: SwcConfig, options?: DefineBuildConfigOptions): webpack.Configuration;
|
|
30
|
+
export {};
|
package/dist/build.js
CHANGED
|
@@ -1,3 +1,219 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import * as __WEBPACK_EXTERNAL_MODULE_html_webpack_plugin_e07f62c9__ from "html-webpack-plugin";
|
|
2
|
+
import * as __WEBPACK_EXTERNAL_MODULE_mini_css_extract_plugin_0b345af5__ from "mini-css-extract-plugin";
|
|
3
|
+
import * as __WEBPACK_EXTERNAL_MODULE_node_module_ab9f2194__ from "node:module";
|
|
4
|
+
import * as __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__ from "node:path";
|
|
5
|
+
import * as __WEBPACK_EXTERNAL_MODULE_terser_webpack_plugin_8f2c9815__ from "terser-webpack-plugin";
|
|
6
|
+
import * as __WEBPACK_EXTERNAL_MODULE_webpack__ from "webpack";
|
|
7
|
+
import * as __WEBPACK_EXTERNAL_MODULE__transformers_applyTransformers_js_6bf4bd94__ from "./transformers/applyTransformers.js";
|
|
8
|
+
import * as __WEBPACK_EXTERNAL_MODULE__utils_js_d88b7fe1__ from "./utils.js";
|
|
9
|
+
|
|
10
|
+
;// CONCATENATED MODULE: external "html-webpack-plugin"
|
|
11
|
+
|
|
12
|
+
;// CONCATENATED MODULE: external "mini-css-extract-plugin"
|
|
13
|
+
|
|
14
|
+
;// CONCATENATED MODULE: external "node:module"
|
|
15
|
+
|
|
16
|
+
;// CONCATENATED MODULE: external "node:path"
|
|
17
|
+
|
|
18
|
+
;// CONCATENATED MODULE: external "terser-webpack-plugin"
|
|
19
|
+
|
|
20
|
+
;// CONCATENATED MODULE: external "webpack"
|
|
21
|
+
|
|
22
|
+
;// CONCATENATED MODULE: external "./transformers/applyTransformers.js"
|
|
23
|
+
|
|
24
|
+
;// CONCATENATED MODULE: external "./utils.js"
|
|
25
|
+
|
|
26
|
+
;// CONCATENATED MODULE: ./src/build.ts?__rslib_entry__
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
// Aliases
|
|
36
|
+
const DefinePlugin = __WEBPACK_EXTERNAL_MODULE_webpack__["default"].DefinePlugin;
|
|
37
|
+
// Using node:module.createRequire until
|
|
38
|
+
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/import.meta/resolve
|
|
39
|
+
// is available
|
|
40
|
+
const build_rslib_entry_require = (0,__WEBPACK_EXTERNAL_MODULE_node_module_ab9f2194__.createRequire)(import.meta.url);
|
|
41
|
+
function defineBuildHtmlWebpackPluginConfig(options = {}) {
|
|
42
|
+
const { template = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].resolve("./public/index.html"), ...rest } = options;
|
|
43
|
+
return {
|
|
44
|
+
...rest,
|
|
45
|
+
template
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
function defineMiniCssExtractPluginConfig(options = {}) {
|
|
49
|
+
const { filename = "[name].css", ...rest } = options;
|
|
50
|
+
return {
|
|
51
|
+
...rest,
|
|
52
|
+
filename
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
function getOptimizationConfig(optimize) {
|
|
56
|
+
if (optimize === "readable") {
|
|
57
|
+
return {
|
|
58
|
+
minimize: true,
|
|
59
|
+
minimizer: [
|
|
60
|
+
new __WEBPACK_EXTERNAL_MODULE_terser_webpack_plugin_8f2c9815__["default"]({
|
|
61
|
+
minify: __WEBPACK_EXTERNAL_MODULE_terser_webpack_plugin_8f2c9815__["default"].swcMinify,
|
|
62
|
+
terserOptions: {
|
|
63
|
+
toplevel: true,
|
|
64
|
+
mangle: false,
|
|
65
|
+
keep_classnames: true,
|
|
66
|
+
keep_fnames: true,
|
|
67
|
+
compress: {
|
|
68
|
+
toplevel: true,
|
|
69
|
+
hoist_props: false
|
|
70
|
+
},
|
|
71
|
+
output: {
|
|
72
|
+
comments: true
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
})
|
|
76
|
+
],
|
|
77
|
+
chunkIds: "named",
|
|
78
|
+
moduleIds: "named",
|
|
79
|
+
mangleExports: false,
|
|
80
|
+
mangleWasmImports: false
|
|
81
|
+
};
|
|
82
|
+
} else if (optimize) {
|
|
83
|
+
return {
|
|
84
|
+
minimize: true,
|
|
85
|
+
minimizer: [
|
|
86
|
+
new __WEBPACK_EXTERNAL_MODULE_terser_webpack_plugin_8f2c9815__["default"]({
|
|
87
|
+
minify: __WEBPACK_EXTERNAL_MODULE_terser_webpack_plugin_8f2c9815__["default"].swcMinify
|
|
88
|
+
})
|
|
89
|
+
]
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
// Doesn't turnoff everything but is good enough to help with debugging scenarios.
|
|
93
|
+
return {
|
|
94
|
+
minimize: false,
|
|
95
|
+
chunkIds: "named",
|
|
96
|
+
moduleIds: "named",
|
|
97
|
+
concatenateModules: false,
|
|
98
|
+
flagIncludedChunks: false,
|
|
99
|
+
mangleExports: false,
|
|
100
|
+
mangleWasmImports: false,
|
|
101
|
+
removeAvailableModules: false,
|
|
102
|
+
usedExports: false
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
function defineBuildConfig(swcConfig, options = {}) {
|
|
106
|
+
const { entry = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].resolve("./src/index.tsx"), outputPath = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].resolve("dist"), // The trailing / is very important, otherwise paths will not be resolved correctly.
|
|
107
|
+
publicPath = "http://localhost:8080/", moduleRules = [], plugins = [], htmlWebpackPlugin = defineBuildHtmlWebpackPluginConfig(), miniCssExtractPluginOptions = defineMiniCssExtractPluginConfig(), optimize = true, cssModules = false, svgr = true, // Using an empty object literal as the default value to ensure
|
|
108
|
+
// "process.env" is always available.
|
|
109
|
+
environmentVariables = {}, transformers = [], verbose = false } = options;
|
|
110
|
+
const config = {
|
|
111
|
+
mode: "production",
|
|
112
|
+
target: "web",
|
|
113
|
+
entry,
|
|
114
|
+
output: {
|
|
115
|
+
path: outputPath,
|
|
116
|
+
filename: "[name].js",
|
|
117
|
+
publicPath,
|
|
118
|
+
clean: true,
|
|
119
|
+
assetModuleFilename: "[name][ext][query]"
|
|
120
|
+
},
|
|
121
|
+
optimization: getOptimizationConfig(optimize),
|
|
122
|
+
infrastructureLogging: verbose ? {
|
|
123
|
+
appendOnly: true,
|
|
124
|
+
level: "verbose",
|
|
125
|
+
debug: /PackFileCache/
|
|
126
|
+
} : undefined,
|
|
127
|
+
module: {
|
|
128
|
+
rules: [
|
|
129
|
+
{
|
|
130
|
+
test: /\.(js|jsx|ts|tsx)$/i,
|
|
131
|
+
exclude: /node_modules/,
|
|
132
|
+
loader: build_rslib_entry_require.resolve("swc-loader"),
|
|
133
|
+
options: swcConfig
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
// https://stackoverflow.com/questions/69427025/programmatic-webpack-jest-esm-cant-resolve-module-without-js-file-exten
|
|
137
|
+
test: /\.js$/i,
|
|
138
|
+
include: /node_modules/,
|
|
139
|
+
resolve: {
|
|
140
|
+
fullySpecified: false
|
|
141
|
+
}
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
test: /\.css$/i,
|
|
145
|
+
use: [
|
|
146
|
+
{
|
|
147
|
+
loader: __WEBPACK_EXTERNAL_MODULE_mini_css_extract_plugin_0b345af5__["default"].loader
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
loader: build_rslib_entry_require.resolve("css-loader"),
|
|
151
|
+
options: cssModules ? {
|
|
152
|
+
// Must match the number of loaders applied before this one.
|
|
153
|
+
importLoaders: 1,
|
|
154
|
+
modules: true
|
|
155
|
+
} : undefined
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
loader: build_rslib_entry_require.resolve("postcss-loader")
|
|
159
|
+
}
|
|
160
|
+
]
|
|
161
|
+
},
|
|
162
|
+
...svgr ? [
|
|
163
|
+
{
|
|
164
|
+
test: /\.svg$/i,
|
|
165
|
+
loader: build_rslib_entry_require.resolve("@svgr/webpack"),
|
|
166
|
+
options: (0,__WEBPACK_EXTERNAL_MODULE__utils_js_d88b7fe1__.isObject)(svgr) ? svgr : undefined
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
test: /\.(png|jpe?g|gif)$/i,
|
|
170
|
+
type: "asset/resource"
|
|
171
|
+
}
|
|
172
|
+
] : [
|
|
173
|
+
{
|
|
174
|
+
test: /\.(png|jpe?g|gif|svg)$/i,
|
|
175
|
+
type: "asset/resource"
|
|
176
|
+
}
|
|
177
|
+
],
|
|
178
|
+
...moduleRules
|
|
179
|
+
]
|
|
180
|
+
},
|
|
181
|
+
resolve: {
|
|
182
|
+
extensions: [
|
|
183
|
+
".js",
|
|
184
|
+
".jsx",
|
|
185
|
+
".ts",
|
|
186
|
+
".tsx",
|
|
187
|
+
".css"
|
|
188
|
+
],
|
|
189
|
+
alias: {
|
|
190
|
+
// Fixes Module not found: Error: Can't resolve '@swc/helpers/_/_class_private_field_init'.
|
|
191
|
+
// View https://github.com/vercel/next.js/pull/38174 for more information and https://github.com/vercel/next.js/issues/48593.
|
|
192
|
+
"@swc/helpers": __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].dirname(build_rslib_entry_require.resolve("@swc/helpers/package.json"))
|
|
193
|
+
}
|
|
194
|
+
},
|
|
195
|
+
plugins: [
|
|
196
|
+
htmlWebpackPlugin && new __WEBPACK_EXTERNAL_MODULE_html_webpack_plugin_e07f62c9__["default"]((0,__WEBPACK_EXTERNAL_MODULE__utils_js_d88b7fe1__.isObject)(htmlWebpackPlugin) ? htmlWebpackPlugin : defineBuildHtmlWebpackPluginConfig()),
|
|
197
|
+
new __WEBPACK_EXTERNAL_MODULE_mini_css_extract_plugin_0b345af5__["default"](miniCssExtractPluginOptions),
|
|
198
|
+
// Stringify the environment variables because the plugin does a direct text replacement. Otherwise, "production" would become production
|
|
199
|
+
// after replacement and cause an undefined var error because the production var doesn't exist.
|
|
200
|
+
// For more information, view: https://webpack.js.org/plugins/define-plugin.
|
|
201
|
+
new DefinePlugin({
|
|
202
|
+
"process.env": Object.keys(environmentVariables).reduce((acc, key)=>{
|
|
203
|
+
acc[key] = JSON.stringify(environmentVariables[key]);
|
|
204
|
+
return acc;
|
|
205
|
+
}, {})
|
|
206
|
+
}),
|
|
207
|
+
...plugins
|
|
208
|
+
].filter(Boolean)
|
|
209
|
+
};
|
|
210
|
+
const transformedConfig = (0,__WEBPACK_EXTERNAL_MODULE__transformers_applyTransformers_js_6bf4bd94__.applyTransformers)(config, transformers, {
|
|
211
|
+
environment: "build",
|
|
212
|
+
verbose
|
|
213
|
+
});
|
|
214
|
+
return transformedConfig;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
export { defineBuildConfig, defineBuildHtmlWebpackPluginConfig, defineMiniCssExtractPluginConfig, getOptimizationConfig };
|
|
218
|
+
|
|
219
|
+
//# sourceMappingURL=build.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build.js","sources":["webpack://@workleap/webpack-configs/./src/build.ts"],"sourcesContent":["import type { Config as SvgrOptions } from \"@svgr/core\";\nimport type { Config as SwcConfig } from \"@swc/core\";\nimport HtmlWebpackPlugin from \"html-webpack-plugin\";\nimport MiniCssExtractPlugin from \"mini-css-extract-plugin\";\nimport { createRequire } from \"node:module\";\nimport path from \"node:path\";\nimport TerserPlugin from \"terser-webpack-plugin\";\nimport webpack from \"webpack\";\nimport { applyTransformers, type WebpackConfigTransformer } from \"./transformers/applyTransformers.ts\";\nimport type { WebpackConfig } from \"./types.ts\";\nimport { isObject } from \"./utils.ts\";\n\n// Aliases\nconst DefinePlugin = webpack.DefinePlugin;\n\n// Using node:module.createRequire until\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/import.meta/resolve\n// is available\nconst require = createRequire(import.meta.url);\n\nexport function defineBuildHtmlWebpackPluginConfig(options: HtmlWebpackPlugin.Options = {}): HtmlWebpackPlugin.Options {\n const {\n template = path.resolve(\"./public/index.html\"),\n ...rest\n } = options;\n\n return {\n ...rest,\n template\n };\n}\n\ntype MiniCssExtractPluginOptions = NonNullable<ConstructorParameters<typeof MiniCssExtractPlugin>[number]>;\n\nexport function defineMiniCssExtractPluginConfig(options: MiniCssExtractPluginOptions = {}): MiniCssExtractPluginOptions {\n const {\n filename = \"[name].css\",\n ...rest\n } = options;\n\n return {\n ...rest,\n filename\n };\n}\n\nexport type WebpackOptimization = NonNullable<WebpackConfig[\"optimization\"]>;\nexport type OptimizeOption = boolean | \"readable\";\n\nexport function getOptimizationConfig(optimize: OptimizeOption): WebpackOptimization {\n if (optimize === \"readable\") {\n return {\n minimize: true,\n minimizer: [\n new TerserPlugin({\n minify: TerserPlugin.swcMinify,\n terserOptions: {\n toplevel: true,\n mangle: false,\n keep_classnames: true,\n keep_fnames: true,\n compress: {\n toplevel: true,\n hoist_props: false\n },\n output: {\n comments: true\n }\n }\n })\n ],\n chunkIds: \"named\",\n moduleIds: \"named\",\n mangleExports: false,\n mangleWasmImports: false\n };\n } else if (optimize) {\n return {\n minimize: true,\n minimizer: [\n new TerserPlugin({\n minify: TerserPlugin.swcMinify\n })\n ]\n };\n }\n\n // Doesn't turnoff everything but is good enough to help with debugging scenarios.\n return {\n minimize: false,\n chunkIds: \"named\",\n moduleIds: \"named\",\n concatenateModules: false,\n flagIncludedChunks: false,\n mangleExports: false,\n mangleWasmImports: false,\n removeAvailableModules: false,\n usedExports: false\n };\n}\n\nexport interface DefineBuildConfigOptions {\n entry?: string;\n outputPath?: string;\n publicPath?: `${string}/` | \"auto\";\n moduleRules?: NonNullable<WebpackConfig[\"module\"]>[\"rules\"];\n plugins?: WebpackConfig[\"plugins\"];\n htmlWebpackPlugin?: boolean | HtmlWebpackPlugin.Options;\n miniCssExtractPluginOptions?: MiniCssExtractPluginOptions;\n optimize?: OptimizeOption;\n cssModules?: boolean;\n svgr?: boolean | SvgrOptions;\n environmentVariables?: Record<string, unknown>;\n transformers?: WebpackConfigTransformer[];\n verbose?: boolean;\n}\n\nexport function defineBuildConfig(swcConfig: SwcConfig, options: DefineBuildConfigOptions = {}) {\n const {\n entry = path.resolve(\"./src/index.tsx\"),\n outputPath = path.resolve(\"dist\"),\n // The trailing / is very important, otherwise paths will not be resolved correctly.\n publicPath = \"http://localhost:8080/\",\n moduleRules = [],\n plugins = [],\n htmlWebpackPlugin = defineBuildHtmlWebpackPluginConfig(),\n miniCssExtractPluginOptions = defineMiniCssExtractPluginConfig(),\n optimize = true,\n cssModules = false,\n svgr = true,\n // Using an empty object literal as the default value to ensure\n // \"process.env\" is always available.\n environmentVariables = {},\n transformers = [],\n verbose = false\n } = options;\n\n const config: WebpackConfig = {\n mode: \"production\",\n target: \"web\",\n entry,\n output: {\n path: outputPath,\n filename: \"[name].js\",\n publicPath,\n clean: true,\n assetModuleFilename: \"[name][ext][query]\"\n },\n optimization: getOptimizationConfig(optimize),\n infrastructureLogging: verbose ? {\n appendOnly: true,\n level: \"verbose\",\n debug: /PackFileCache/\n } : undefined,\n module: {\n rules: [\n {\n test: /\\.(js|jsx|ts|tsx)$/i,\n exclude: /node_modules/,\n loader: require.resolve(\"swc-loader\"),\n options: swcConfig\n },\n {\n // https://stackoverflow.com/questions/69427025/programmatic-webpack-jest-esm-cant-resolve-module-without-js-file-exten\n test: /\\.js$/i,\n include: /node_modules/,\n resolve: {\n fullySpecified: false\n }\n },\n {\n test: /\\.css$/i,\n use: [\n { loader: MiniCssExtractPlugin.loader },\n {\n loader: require.resolve(\"css-loader\"),\n options: cssModules\n ? {\n // Must match the number of loaders applied before this one.\n importLoaders: 1,\n modules: true\n }\n : undefined\n },\n { loader: require.resolve(\"postcss-loader\") }\n ]\n },\n ...(svgr\n ? [\n {\n test: /\\.svg$/i,\n loader: require.resolve(\"@svgr/webpack\"),\n options: isObject(svgr) ? svgr : undefined\n },\n {\n test: /\\.(png|jpe?g|gif)$/i,\n type: \"asset/resource\"\n }\n ]\n : [\n {\n test: /\\.(png|jpe?g|gif|svg)$/i,\n type: \"asset/resource\"\n }\n ]),\n ...moduleRules\n ]\n },\n resolve: {\n extensions: [\".js\", \".jsx\", \".ts\", \".tsx\", \".css\"],\n alias: {\n // Fixes Module not found: Error: Can't resolve '@swc/helpers/_/_class_private_field_init'.\n // View https://github.com/vercel/next.js/pull/38174 for more information and https://github.com/vercel/next.js/issues/48593.\n \"@swc/helpers\": path.dirname(require.resolve(\"@swc/helpers/package.json\"))\n }\n },\n plugins: [\n htmlWebpackPlugin && new HtmlWebpackPlugin(isObject(htmlWebpackPlugin) ? htmlWebpackPlugin : defineBuildHtmlWebpackPluginConfig()),\n new MiniCssExtractPlugin(miniCssExtractPluginOptions),\n // Stringify the environment variables because the plugin does a direct text replacement. Otherwise, \"production\" would become production\n // after replacement and cause an undefined var error because the production var doesn't exist.\n // For more information, view: https://webpack.js.org/plugins/define-plugin.\n new DefinePlugin({\n \"process.env\": Object.keys(environmentVariables).reduce((acc, key) => {\n acc[key] = JSON.stringify(environmentVariables[key]);\n\n return acc;\n }, {} as Record<string, string>)\n }),\n ...plugins\n ].filter(Boolean) as WebpackConfig[\"plugins\"]\n };\n\n const transformedConfig = applyTransformers(config, transformers, {\n environment: \"build\",\n verbose\n });\n\n return transformedConfig;\n}\n"],"names":["HtmlWebpackPlugin","MiniCssExtractPlugin","createRequire","path","TerserPlugin","webpack","applyTransformers","isObject","DefinePlugin","require","defineBuildHtmlWebpackPluginConfig","options","template","rest","defineMiniCssExtractPluginConfig","filename","getOptimizationConfig","optimize","defineBuildConfig","swcConfig","entry","outputPath","publicPath","moduleRules","plugins","htmlWebpackPlugin","miniCssExtractPluginOptions","cssModules","svgr","environmentVariables","transformers","verbose","config","undefined","Object","acc","key","JSON","Boolean","transformedConfig"],"mappings":"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"}
|
package/dist/dev.d.ts
CHANGED
|
@@ -1,31 +1,30 @@
|
|
|
1
|
-
import { ReactRefreshPluginOptions } from
|
|
2
|
-
import { Config } from
|
|
3
|
-
import { Config as
|
|
4
|
-
import HtmlWebpackPlugin from
|
|
5
|
-
import webpack
|
|
6
|
-
import { ServerOptions } from
|
|
7
|
-
import { WebpackConfigTransformer } from
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
declare function
|
|
11
|
-
|
|
1
|
+
import type { ReactRefreshPluginOptions } from "@pmmmwh/react-refresh-webpack-plugin/types/lib/types.d.ts";
|
|
2
|
+
import type { Config as SvgrOptions } from "@svgr/core";
|
|
3
|
+
import type { Config as SwcConfig } from "@swc/core";
|
|
4
|
+
import HtmlWebpackPlugin from "html-webpack-plugin";
|
|
5
|
+
import webpack from "webpack";
|
|
6
|
+
import type { ServerOptions } from "webpack-dev-server";
|
|
7
|
+
import { type WebpackConfigTransformer } from "./transformers/applyTransformers.ts";
|
|
8
|
+
import "webpack-dev-server";
|
|
9
|
+
import type { WebpackConfig } from "./types.ts";
|
|
10
|
+
export declare function defineDevHtmlWebpackPluginConfig(options?: HtmlWebpackPlugin.Options): HtmlWebpackPlugin.Options;
|
|
11
|
+
export declare function defineFastRefreshPluginConfig(options?: ReactRefreshPluginOptions): ReactRefreshPluginOptions;
|
|
12
|
+
export interface DefineDevConfigOptions {
|
|
12
13
|
entry?: string;
|
|
13
14
|
https?: boolean | ServerOptions | undefined;
|
|
14
15
|
host?: string;
|
|
15
16
|
port?: number;
|
|
16
17
|
publicPath?: `${string}/` | "auto";
|
|
17
18
|
cache?: boolean;
|
|
18
|
-
moduleRules?: NonNullable<
|
|
19
|
-
plugins?:
|
|
19
|
+
moduleRules?: NonNullable<WebpackConfig["module"]>["rules"];
|
|
20
|
+
plugins?: WebpackConfig["plugins"];
|
|
20
21
|
htmlWebpackPlugin?: boolean | HtmlWebpackPlugin.Options;
|
|
21
22
|
fastRefresh?: boolean | ReactRefreshPluginOptions;
|
|
22
23
|
cssModules?: boolean;
|
|
23
24
|
overlay?: false;
|
|
24
|
-
svgr?: boolean |
|
|
25
|
+
svgr?: boolean | SvgrOptions;
|
|
25
26
|
environmentVariables?: Record<string, unknown>;
|
|
26
27
|
transformers?: WebpackConfigTransformer[];
|
|
27
28
|
verbose?: boolean;
|
|
28
29
|
}
|
|
29
|
-
declare function defineDevConfig(swcConfig:
|
|
30
|
-
|
|
31
|
-
export { type DefineDevConfigOptions, defineDevConfig, defineDevHtmlWebpackPluginConfig, defineFastRefreshPluginConfig };
|
|
30
|
+
export declare function defineDevConfig(swcConfig: SwcConfig, options?: DefineDevConfigOptions): webpack.Configuration;
|