@workleap/webpack-configs 0.0.2 → 1.0.0
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/README.md +17 -2
- package/dist/build.d.ts +4 -5
- package/dist/build.js +1 -1
- package/dist/{chunk-YF3OAEUP.js → chunk-34O5ZLZ6.js} +4 -4
- package/dist/{chunk-GSID5BLX.js → chunk-JPURRV2F.js} +4 -4
- package/dist/{chunk-ZKKR575Q.js → chunk-OVSH7SYO.js} +4 -10
- package/dist/{chunk-XOV4FKHU.js → chunk-QSPIAXE3.js} +5 -13
- package/dist/dev.d.ts +2 -3
- package/dist/dev.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +4 -4
- package/dist/transformers/moduleRules.js +1 -1
- package/dist/transformers/plugins.js +1 -1
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @workleap/webpack-configs
|
|
2
2
|
|
|
3
|
+
## 1.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- [#98](https://github.com/gsoft-inc/wl-web-configs/pull/98) [`56ca32e`](https://github.com/gsoft-inc/wl-web-configs/commit/56ca32ee3194c51210aacc5189f3ebbec5a4a7b6) Thanks [@patricklafrance](https://github.com/patricklafrance)! - New start, every package has a major version bump
|
|
8
|
+
|
|
3
9
|
## 0.0.2
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -1,7 +1,22 @@
|
|
|
1
1
|
# webpack-configs
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](../../LICENSE)
|
|
4
|
+
[](https://www.npmjs.com/package/@workleap/webpack-configs)
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
## Usage
|
|
7
|
+
|
|
8
|
+
View the [user's documentation](https://gsoft-inc.github.io/wl-web-configs/).
|
|
9
|
+
|
|
10
|
+
## 🤝 Contributing
|
|
11
|
+
|
|
12
|
+
View the [contributor's documentation](../../CONTRIBUTING.md).
|
|
13
|
+
|
|
14
|
+
### Notes
|
|
15
|
+
|
|
16
|
+
#### Add the @swc/helpers packages to all monorepo imported projects having JSX code
|
|
6
17
|
|
|
7
18
|
To work properly, all projects having React/JSX code that are referenced by the host project must also install `@swc/helpers` as a `devDependency`.
|
|
19
|
+
|
|
20
|
+
## License
|
|
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/gsoft-inc/workleap-license/blob/master/LICENSE.
|
package/dist/build.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Config } from '@swc/core';
|
|
2
2
|
import HtmlWebpackPlugin from 'html-webpack-plugin';
|
|
3
3
|
import MiniCssExtractPlugin from 'mini-css-extract-plugin';
|
|
4
|
-
import
|
|
4
|
+
import { Configuration } from 'webpack';
|
|
5
5
|
import { WebpackConfigTransformer } from './transformers/applyTransformers.js';
|
|
6
6
|
|
|
7
7
|
type MiniCssExtractPluginOptions = NonNullable<ConstructorParameters<typeof MiniCssExtractPlugin>[number]>;
|
|
@@ -13,15 +13,14 @@ interface DefineBuildConfigOptions {
|
|
|
13
13
|
publicPath?: string;
|
|
14
14
|
moduleRules?: NonNullable<Configuration["module"]>["rules"];
|
|
15
15
|
plugins?: Configuration["plugins"];
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
htmlWebpackPluginOptions?: HtmlWebpackPlugin.Options;
|
|
17
|
+
miniCssExtractPluginOptions?: MiniCssExtractPluginOptions;
|
|
18
18
|
minify?: boolean;
|
|
19
19
|
cssModules?: boolean;
|
|
20
|
-
postcssConfigFilePath?: string;
|
|
21
20
|
swcConfig: Config;
|
|
22
21
|
environmentVariables?: Record<string, string | undefined>;
|
|
23
22
|
transformers?: WebpackConfigTransformer[];
|
|
24
23
|
}
|
|
25
|
-
declare function defineBuildConfig(options: DefineBuildConfigOptions):
|
|
24
|
+
declare function defineBuildConfig(options: DefineBuildConfigOptions): Configuration;
|
|
26
25
|
|
|
27
26
|
export { DefineBuildConfigOptions, defineBuildConfig, defineBuildHtmlWebpackPluginConfig, defineMiniCssExtractPluginConfig };
|
package/dist/build.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { defineBuildConfig, defineBuildHtmlWebpackPluginConfig, defineMiniCssExtractPluginConfig } from './chunk-
|
|
1
|
+
export { defineBuildConfig, defineBuildHtmlWebpackPluginConfig, defineMiniCssExtractPluginConfig } from './chunk-QSPIAXE3.js';
|
|
2
2
|
import './chunk-URL2KA63.js';
|
|
@@ -107,7 +107,7 @@ function addBeforeModuleRule(config, matcher, newModuleRules) {
|
|
|
107
107
|
match.parent.splice(match.index, 0, ...newModuleRules);
|
|
108
108
|
} else {
|
|
109
109
|
const matcherInfo = matcher.info;
|
|
110
|
-
|
|
110
|
+
throw new Error(`[webpack-configs] Couldn't add the new module rules because no match has been found.
|
|
111
111
|
[webpack-configs] Matcher: "${JSON.stringify(matcherInfo)}"`);
|
|
112
112
|
}
|
|
113
113
|
}
|
|
@@ -117,7 +117,7 @@ function addAfterModuleRule(config, matcher, newModuleRules) {
|
|
|
117
117
|
match.parent.splice(match.index + 1, 0, ...newModuleRules);
|
|
118
118
|
} else {
|
|
119
119
|
const matcherInfo = matcher.info;
|
|
120
|
-
|
|
120
|
+
throw new Error(`[webpack-configs] Couldn't add the new module rules because no match has been found.
|
|
121
121
|
[webpack-configs] Matcher: "${JSON.stringify(matcherInfo)}"`);
|
|
122
122
|
}
|
|
123
123
|
}
|
|
@@ -127,7 +127,7 @@ function replaceModuleRule(config, matcher, newModuleRule) {
|
|
|
127
127
|
match.parent[match.index] = newModuleRule;
|
|
128
128
|
} else {
|
|
129
129
|
const matcherInfo = matcher.info;
|
|
130
|
-
|
|
130
|
+
throw new Error(`[webpack-configs] Couldn't replace the module rule because no match has been found.
|
|
131
131
|
[webpack-configs] Matcher: "${JSON.stringify(matcherInfo)}"`);
|
|
132
132
|
}
|
|
133
133
|
}
|
|
@@ -146,7 +146,7 @@ function removeModuleRules(config, matcher) {
|
|
|
146
146
|
});
|
|
147
147
|
} else {
|
|
148
148
|
const matcherInfo = matcher.info;
|
|
149
|
-
|
|
149
|
+
throw new Error(`[webpack-configs] Didn't remove any module rules because no match has been found.
|
|
150
150
|
[webpack-configs] Matcher: "${matcherInfo}"`);
|
|
151
151
|
}
|
|
152
152
|
}
|
|
@@ -33,7 +33,7 @@ function replacePlugin(config, matcher, newPlugin) {
|
|
|
33
33
|
config.plugins[match.index] = newPlugin;
|
|
34
34
|
} else {
|
|
35
35
|
const matcherInfo = matcher.info;
|
|
36
|
-
|
|
36
|
+
throw new Error(`[webpack-configs] Couldn't replace the plugin because no match has been found.
|
|
37
37
|
[webpack-configs] Matcher: "${JSON.stringify(matcherInfo)}"`);
|
|
38
38
|
}
|
|
39
39
|
}
|
|
@@ -43,7 +43,7 @@ function addBeforePlugin(config, matcher, newPlugins) {
|
|
|
43
43
|
config.plugins?.splice(match.index, 0, ...newPlugins);
|
|
44
44
|
} else {
|
|
45
45
|
const matcherInfo = matcher.info;
|
|
46
|
-
|
|
46
|
+
throw new Error(`[webpack-configs] Couldn't add the new plugins because no match has been found.
|
|
47
47
|
[webpack-configs] Matcher: "${JSON.stringify(matcherInfo)}"`);
|
|
48
48
|
}
|
|
49
49
|
}
|
|
@@ -53,7 +53,7 @@ function addAfterPlugin(config, matcher, newPlugins) {
|
|
|
53
53
|
config.plugins?.splice(match.index + 1, 0, ...newPlugins);
|
|
54
54
|
} else {
|
|
55
55
|
const matcherInfo = matcher.info;
|
|
56
|
-
|
|
56
|
+
throw new Error(`[webpack-configs] Couldn't add the new plugins because no match has been found.
|
|
57
57
|
[webpack-configs] Matcher: "${JSON.stringify(matcherInfo)}"`);
|
|
58
58
|
}
|
|
59
59
|
}
|
|
@@ -63,7 +63,7 @@ function removePlugin(config, matcher) {
|
|
|
63
63
|
const countAfter = config.plugins?.length ?? 0;
|
|
64
64
|
if (countBefore === countAfter) {
|
|
65
65
|
const matcherInfo = matcher.info;
|
|
66
|
-
|
|
66
|
+
throw new Error(`[webpack-configs] Didn't remove any plugin because no match has been found.
|
|
67
67
|
[webpack-configs] Matcher: "${JSON.stringify(matcherInfo)}"`);
|
|
68
68
|
}
|
|
69
69
|
}
|
|
@@ -53,7 +53,6 @@ function defineDevConfig(options) {
|
|
|
53
53
|
htmlWebpackPluginOptions = defineDevHtmlWebpackPluginConfig(),
|
|
54
54
|
fastRefresh = false,
|
|
55
55
|
cssModules = false,
|
|
56
|
-
postcssConfigFilePath,
|
|
57
56
|
swcConfig,
|
|
58
57
|
environmentVariables,
|
|
59
58
|
transformers = []
|
|
@@ -63,7 +62,9 @@ function defineDevConfig(options) {
|
|
|
63
62
|
target: "web",
|
|
64
63
|
devtool: "eval-cheap-module-source-map",
|
|
65
64
|
devServer: {
|
|
66
|
-
hot:
|
|
65
|
+
// According to the Fast Refresh plugin documentation, hot should be "true" to enable Fast Refresh:
|
|
66
|
+
// https://github.com/pmmmwh/react-refresh-webpack-plugin#usage.
|
|
67
|
+
hot: true,
|
|
67
68
|
https,
|
|
68
69
|
host,
|
|
69
70
|
port,
|
|
@@ -117,14 +118,7 @@ function defineDevConfig(options) {
|
|
|
117
118
|
modules: true
|
|
118
119
|
} : void 0
|
|
119
120
|
},
|
|
120
|
-
{
|
|
121
|
-
loader: require2.resolve("postcss-loader"),
|
|
122
|
-
options: postcssConfigFilePath ? {
|
|
123
|
-
postcssOptions: {
|
|
124
|
-
config: postcssConfigFilePath
|
|
125
|
-
}
|
|
126
|
-
} : void 0
|
|
127
|
-
}
|
|
121
|
+
{ loader: require2.resolve("postcss-loader") }
|
|
128
122
|
]
|
|
129
123
|
},
|
|
130
124
|
{
|
|
@@ -36,11 +36,10 @@ function defineBuildConfig(options) {
|
|
|
36
36
|
publicPath = "http://localhost:8080/",
|
|
37
37
|
moduleRules = [],
|
|
38
38
|
plugins = [],
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
htmlWebpackPluginOptions = defineBuildHtmlWebpackPluginConfig(),
|
|
40
|
+
miniCssExtractPluginOptions = defineMiniCssExtractPluginConfig(),
|
|
41
41
|
minify = true,
|
|
42
42
|
cssModules = false,
|
|
43
|
-
postcssConfigFilePath,
|
|
44
43
|
swcConfig,
|
|
45
44
|
environmentVariables,
|
|
46
45
|
transformers = []
|
|
@@ -95,14 +94,7 @@ function defineBuildConfig(options) {
|
|
|
95
94
|
modules: true
|
|
96
95
|
} : void 0
|
|
97
96
|
},
|
|
98
|
-
{
|
|
99
|
-
loader: require2.resolve("postcss-loader"),
|
|
100
|
-
options: postcssConfigFilePath ? {
|
|
101
|
-
postcssOptions: {
|
|
102
|
-
config: postcssConfigFilePath
|
|
103
|
-
}
|
|
104
|
-
} : void 0
|
|
105
|
-
}
|
|
97
|
+
{ loader: require2.resolve("postcss-loader") }
|
|
106
98
|
]
|
|
107
99
|
},
|
|
108
100
|
{
|
|
@@ -120,8 +112,8 @@ function defineBuildConfig(options) {
|
|
|
120
112
|
extensions: [".js", ".jsx", ".ts", ".tsx", ".css"]
|
|
121
113
|
},
|
|
122
114
|
plugins: [
|
|
123
|
-
new HtmlWebpackPlugin(
|
|
124
|
-
new MiniCssExtractPlugin(
|
|
115
|
+
new HtmlWebpackPlugin(htmlWebpackPluginOptions),
|
|
116
|
+
new MiniCssExtractPlugin(miniCssExtractPluginOptions),
|
|
125
117
|
new DefinePlugin({
|
|
126
118
|
// Parenthesis around the stringified object are mandatory otherwise it breaks
|
|
127
119
|
// at build time.
|
package/dist/dev.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ReactRefreshPluginOptions } from '@pmmmwh/react-refresh-webpack-plugin/types/lib/types.d.ts';
|
|
2
2
|
import { Config } from '@swc/core';
|
|
3
3
|
import HtmlWebpackPlugin from 'html-webpack-plugin';
|
|
4
|
-
import
|
|
4
|
+
import { Configuration } from 'webpack';
|
|
5
5
|
import { WebpackConfigTransformer } from './transformers/applyTransformers.js';
|
|
6
6
|
|
|
7
7
|
declare function defineDevHtmlWebpackPluginConfig(options?: HtmlWebpackPlugin.Options): HtmlWebpackPlugin.Options;
|
|
@@ -18,11 +18,10 @@ interface DefineDevConfigOptions {
|
|
|
18
18
|
htmlWebpackPluginOptions?: HtmlWebpackPlugin.Options;
|
|
19
19
|
fastRefresh?: boolean | ReactRefreshPluginOptions;
|
|
20
20
|
cssModules?: boolean;
|
|
21
|
-
postcssConfigFilePath?: string;
|
|
22
21
|
swcConfig: Config;
|
|
23
22
|
environmentVariables?: Record<string, string | undefined>;
|
|
24
23
|
transformers?: WebpackConfigTransformer[];
|
|
25
24
|
}
|
|
26
|
-
declare function defineDevConfig(options: DefineDevConfigOptions):
|
|
25
|
+
declare function defineDevConfig(options: DefineDevConfigOptions): Configuration;
|
|
27
26
|
|
|
28
27
|
export { DefineDevConfigOptions, defineDevConfig, defineDevHtmlWebpackPluginConfig, defineFastRefreshPluginConfig };
|
package/dist/dev.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { defineDevConfig, defineDevHtmlWebpackPluginConfig, defineFastRefreshPluginConfig } from './chunk-
|
|
1
|
+
export { defineDevConfig, defineDevHtmlWebpackPluginConfig, defineFastRefreshPluginConfig } from './chunk-OVSH7SYO.js';
|
|
2
2
|
import './chunk-P2Z3EEVF.js';
|
|
3
3
|
import './chunk-URL2KA63.js';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export { Configuration as WebpackConfig } from 'webpack';
|
|
1
2
|
export { DefineBuildConfigOptions, defineBuildConfig, defineBuildHtmlWebpackPluginConfig, defineMiniCssExtractPluginConfig } from './build.js';
|
|
2
3
|
export { DefineDevConfigOptions, defineDevConfig, defineDevHtmlWebpackPluginConfig, defineFastRefreshPluginConfig } from './dev.js';
|
|
3
4
|
export { WebpackConfigTransformer, WebpackConfigTransformerContext } from './transformers/applyTransformers.js';
|
|
@@ -6,5 +7,4 @@ export { PluginMatch, PluginMatcher, WebpackPlugin, WithPluginMatcherInfo, addAf
|
|
|
6
7
|
import '@swc/core';
|
|
7
8
|
import 'html-webpack-plugin';
|
|
8
9
|
import 'mini-css-extract-plugin';
|
|
9
|
-
import 'webpack';
|
|
10
10
|
import '@pmmmwh/react-refresh-webpack-plugin/types/lib/types.d.ts';
|
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-QSPIAXE3.js';
|
|
2
|
+
export { defineDevConfig, defineDevHtmlWebpackPluginConfig, defineFastRefreshPluginConfig } from './chunk-OVSH7SYO.js';
|
|
3
3
|
import './chunk-P2Z3EEVF.js';
|
|
4
4
|
import './chunk-URL2KA63.js';
|
|
5
|
-
export { addAfterModuleRule, addBeforeModuleRule, findModuleRule, findModuleRules, matchAssetModuleType, matchLoaderName, matchTest, removeModuleRules, replaceModuleRule } from './chunk-
|
|
6
|
-
export { addAfterPlugin, addBeforePlugin, findPlugin, matchConstructorName, removePlugin, replacePlugin } from './chunk-
|
|
5
|
+
export { addAfterModuleRule, addBeforeModuleRule, findModuleRule, findModuleRules, matchAssetModuleType, matchLoaderName, matchTest, removeModuleRules, replaceModuleRule } from './chunk-34O5ZLZ6.js';
|
|
6
|
+
export { addAfterPlugin, addBeforePlugin, findPlugin, matchConstructorName, removePlugin, replacePlugin } from './chunk-JPURRV2F.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { addAfterModuleRule, addBeforeModuleRule, findModuleRule, findModuleRules, matchAssetModuleType, matchLoaderName, matchTest, removeModuleRules, replaceModuleRule } from '../chunk-
|
|
1
|
+
export { addAfterModuleRule, addBeforeModuleRule, findModuleRule, findModuleRules, matchAssetModuleType, matchLoaderName, matchTest, removeModuleRules, replaceModuleRule } from '../chunk-34O5ZLZ6.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { addAfterPlugin, addBeforePlugin, findPlugin, matchConstructorName, removePlugin, replacePlugin } from '../chunk-
|
|
1
|
+
export { addAfterPlugin, addBeforePlugin, findPlugin, matchConstructorName, removePlugin, replacePlugin } from '../chunk-JPURRV2F.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": "0.0
|
|
5
|
+
"version": "1.0.0",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"keywords": [
|
|
8
8
|
"workleap",
|
|
@@ -71,10 +71,10 @@
|
|
|
71
71
|
"typescript": "5.0.4",
|
|
72
72
|
"webpack": "5.86.0",
|
|
73
73
|
"webpack-dev-server": "4.15.0",
|
|
74
|
-
"@workleap/eslint-plugin": "
|
|
75
|
-
"@workleap/swc-configs": "
|
|
76
|
-
"@workleap/tsup-configs": "
|
|
77
|
-
"@workleap/typescript-configs": "
|
|
74
|
+
"@workleap/eslint-plugin": "2.0.0",
|
|
75
|
+
"@workleap/swc-configs": "2.0.0",
|
|
76
|
+
"@workleap/tsup-configs": "3.0.0",
|
|
77
|
+
"@workleap/typescript-configs": "3.0.0"
|
|
78
78
|
},
|
|
79
79
|
"publishConfig": {
|
|
80
80
|
"access": "public",
|