@rsbuild/webpack 0.0.14 → 0.0.16
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.
|
@@ -56,12 +56,12 @@ async function modifyWebpackConfig(context, webpackConfig, utils) {
|
|
|
56
56
|
utils
|
|
57
57
|
);
|
|
58
58
|
if ((_a = context.config.tools) == null ? void 0 : _a.webpack) {
|
|
59
|
-
modifiedConfig = (0, import_shared.mergeChainedOptions)(
|
|
60
|
-
modifiedConfig,
|
|
61
|
-
context.config.tools.webpack,
|
|
59
|
+
modifiedConfig = (0, import_shared.mergeChainedOptions)({
|
|
60
|
+
defaults: modifiedConfig,
|
|
61
|
+
options: context.config.tools.webpack,
|
|
62
62
|
utils,
|
|
63
|
-
utils.mergeConfig
|
|
64
|
-
);
|
|
63
|
+
mergeFn: utils.mergeConfig
|
|
64
|
+
});
|
|
65
65
|
}
|
|
66
66
|
(0, import_shared.debug)("modify webpack config done");
|
|
67
67
|
return modifiedConfig;
|
package/dist/plugins/babel.js
CHANGED
|
@@ -92,14 +92,14 @@ const pluginBabel = () => ({
|
|
|
92
92
|
baseBabelConfig,
|
|
93
93
|
config2.performance.transformLodash
|
|
94
94
|
);
|
|
95
|
-
const babelConfig = (0, import_shared.mergeChainedOptions)(
|
|
96
|
-
baseBabelConfig,
|
|
97
|
-
config2.tools.babel,
|
|
98
|
-
{
|
|
95
|
+
const babelConfig = (0, import_shared.mergeChainedOptions)({
|
|
96
|
+
defaults: baseBabelConfig,
|
|
97
|
+
options: config2.tools.babel,
|
|
98
|
+
utils: {
|
|
99
99
|
...(0, import_plugin_babel.getBabelUtils)(baseBabelConfig),
|
|
100
100
|
...babelUtils
|
|
101
101
|
}
|
|
102
|
-
);
|
|
102
|
+
});
|
|
103
103
|
const finalOptions = {
|
|
104
104
|
babelrc: false,
|
|
105
105
|
configFile: false,
|
package/dist/plugins/css.js
CHANGED
|
@@ -49,14 +49,6 @@ async function applyBaseCSSRule({
|
|
|
49
49
|
const enableCssMinify = !enableExtractCSS && isProd;
|
|
50
50
|
const enableSourceMap = (0, import_shared.isUseCssSourceMap)(config);
|
|
51
51
|
const enableCSSModuleTS = Boolean(config.output.enableCssModuleTSDeclaration);
|
|
52
|
-
const extraCSSOptions = typeof config.tools.cssExtract === "object" ? config.tools.cssExtract : {
|
|
53
|
-
loaderOptions: {},
|
|
54
|
-
pluginOptions: {}
|
|
55
|
-
};
|
|
56
|
-
const styleLoaderOptions = (0, import_shared.mergeChainedOptions)(
|
|
57
|
-
{},
|
|
58
|
-
config.tools.styleLoader
|
|
59
|
-
);
|
|
60
52
|
const localIdentName = (0, import_shared.getCssModuleLocalIdentName)(config, isProd);
|
|
61
53
|
const cssLoaderOptions = await (0, import_shared.getCssLoaderOptions)({
|
|
62
54
|
config,
|
|
@@ -68,8 +60,16 @@ async function applyBaseCSSRule({
|
|
|
68
60
|
});
|
|
69
61
|
if (!isServer && !isWebWorker) {
|
|
70
62
|
if (enableExtractCSS) {
|
|
63
|
+
const extraCSSOptions = typeof config.tools.cssExtract === "object" ? config.tools.cssExtract : {
|
|
64
|
+
loaderOptions: {},
|
|
65
|
+
pluginOptions: {}
|
|
66
|
+
};
|
|
71
67
|
rule.use(CHAIN_ID.USE.MINI_CSS_EXTRACT).loader(require("mini-css-extract-plugin").loader).options(extraCSSOptions.loaderOptions).end();
|
|
72
68
|
} else {
|
|
69
|
+
const styleLoaderOptions = (0, import_shared.mergeChainedOptions)({
|
|
70
|
+
defaults: {},
|
|
71
|
+
options: config.tools.styleLoader
|
|
72
|
+
});
|
|
73
73
|
rule.use(CHAIN_ID.USE.STYLE).loader(require.resolve("style-loader")).options(styleLoaderOptions).end();
|
|
74
74
|
}
|
|
75
75
|
if (enableCSSModuleTS && cssLoaderOptions.modules) {
|
package/dist/plugins/output.js
CHANGED
|
@@ -43,10 +43,10 @@ const pluginOutput = () => ({
|
|
|
43
43
|
const cssPath = (0, import_shared.getDistPath)(config.output, "css");
|
|
44
44
|
if ((0, import_shared.isUseCssExtract)(config, target)) {
|
|
45
45
|
const { default: MiniCssExtractPlugin } = await Promise.resolve().then(() => __toESM(require("mini-css-extract-plugin")));
|
|
46
|
-
const extractPluginOptions = (0, import_shared.mergeChainedOptions)(
|
|
47
|
-
{},
|
|
48
|
-
(
|
|
49
|
-
);
|
|
46
|
+
const extractPluginOptions = (0, import_shared.mergeChainedOptions)({
|
|
47
|
+
defaults: {},
|
|
48
|
+
options: (_a = config.tools.cssExtract) == null ? void 0 : _a.pluginOptions
|
|
49
|
+
});
|
|
50
50
|
const cssFilename = (0, import_shared.getFilename)(config.output, "css", isProd);
|
|
51
51
|
chain.plugin(CHAIN_ID.PLUGIN.MINI_CSS_EXTRACT).use(MiniCssExtractPlugin, [
|
|
52
52
|
{
|
package/dist/plugins/tsLoader.js
CHANGED
|
@@ -57,11 +57,11 @@ const pluginTsLoader = () => {
|
|
|
57
57
|
}
|
|
58
58
|
});
|
|
59
59
|
const babelUtils = (0, import_plugin_babel.getBabelUtils)(baseBabelConfig);
|
|
60
|
-
const babelLoaderOptions = (0, import_shared.mergeChainedOptions)(
|
|
61
|
-
baseBabelConfig,
|
|
62
|
-
config.tools.babel,
|
|
63
|
-
babelUtils
|
|
64
|
-
);
|
|
60
|
+
const babelLoaderOptions = (0, import_shared.mergeChainedOptions)({
|
|
61
|
+
defaults: baseBabelConfig,
|
|
62
|
+
options: config.tools.babel,
|
|
63
|
+
utils: babelUtils
|
|
64
|
+
});
|
|
65
65
|
const includes = [];
|
|
66
66
|
const excludes = [];
|
|
67
67
|
const tsLoaderUtils = {
|
|
@@ -72,18 +72,20 @@ const pluginTsLoader = () => {
|
|
|
72
72
|
excludes.push(...(0, import_shared.castArray)(items));
|
|
73
73
|
}
|
|
74
74
|
};
|
|
75
|
-
const
|
|
76
|
-
{
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
module: "esnext"
|
|
80
|
-
},
|
|
81
|
-
transpileOnly: true,
|
|
82
|
-
allowTsInNodeModules: true
|
|
75
|
+
const tsLoaderDefaultOptions = {
|
|
76
|
+
compilerOptions: {
|
|
77
|
+
target: "esnext",
|
|
78
|
+
module: "esnext"
|
|
83
79
|
},
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
80
|
+
transpileOnly: true,
|
|
81
|
+
allowTsInNodeModules: true
|
|
82
|
+
};
|
|
83
|
+
const tsLoaderOptions = (0, import_shared.mergeChainedOptions)({
|
|
84
|
+
defaults: tsLoaderDefaultOptions,
|
|
85
|
+
// @ts-expect-error ts-loader has incorrect types for compilerOptions
|
|
86
|
+
options: config.tools.tsLoader,
|
|
87
|
+
utils: tsLoaderUtils
|
|
88
|
+
});
|
|
87
89
|
const rule = chain.module.rule(CHAIN_ID.RULE.TS);
|
|
88
90
|
(0, import_shared.applyScriptCondition)({
|
|
89
91
|
rule,
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import type { ArrayOrNot, ChainedConfig, FileFilterUtil, TerserPluginOptions, ToolsConfig as BaseToolsConfig } from '@rsbuild/shared';
|
|
1
|
+
import type { ArrayOrNot, ChainedConfig, FileFilterUtil, TerserPluginOptions, ToolsConfig as BaseToolsConfig, ChainedConfigWithUtils } from '@rsbuild/shared';
|
|
2
2
|
import type { BabelTransformOptions, BabelConfigUtils } from '@rsbuild/plugin-babel';
|
|
3
3
|
import type { PluginCssMinimizerOptions } from '@rsbuild/plugin-css-minimizer';
|
|
4
4
|
import type { ModifyWebpackChainUtils, ModifyWebpackConfigUtils } from '../hooks';
|
|
5
5
|
import type { WebpackChain, WebpackConfig, TSLoaderOptions, CSSExtractOptions } from '../thirdParty';
|
|
6
6
|
import type { NormalizedCSSExtractOptions } from '../thirdParty/css';
|
|
7
7
|
export type ToolsTerserConfig = ChainedConfig<TerserPluginOptions>;
|
|
8
|
-
export type ToolsTSLoaderConfig =
|
|
8
|
+
export type ToolsTSLoaderConfig = ChainedConfigWithUtils<TSLoaderOptions, {
|
|
9
9
|
addIncludes: FileFilterUtil;
|
|
10
10
|
addExcludes: FileFilterUtil;
|
|
11
11
|
}>;
|
|
12
12
|
export type ToolsCssExtractConfig = CSSExtractOptions | ((options: CSSExtractOptions) => CSSExtractOptions | void);
|
|
13
|
-
export type ToolsWebpackConfig =
|
|
13
|
+
export type ToolsWebpackConfig = ChainedConfigWithUtils<WebpackConfig, ModifyWebpackConfigUtils>;
|
|
14
14
|
export type ToolsWebpackChainConfig = ArrayOrNot<(chain: WebpackChain, utils: ModifyWebpackChainUtils) => void>;
|
|
15
|
-
export type ToolsBabelConfig =
|
|
15
|
+
export type ToolsBabelConfig = ChainedConfigWithUtils<BabelTransformOptions, BabelConfigUtils>;
|
|
16
16
|
export interface ToolsConfig extends BaseToolsConfig {
|
|
17
17
|
/**
|
|
18
18
|
* Modify the options of [babel-loader](https://github.com/babel/babel-loader)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsbuild/webpack",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.16",
|
|
4
4
|
"homepage": "https://rsbuild.dev",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -59,11 +59,11 @@
|
|
|
59
59
|
"tsconfig-paths-webpack-plugin": "4.1.0",
|
|
60
60
|
"webpack": "^5.89.0",
|
|
61
61
|
"webpack-subresource-integrity": "5.1.0",
|
|
62
|
-
"@rsbuild/babel-preset": "0.0.
|
|
63
|
-
"@rsbuild/
|
|
64
|
-
"@rsbuild/plugin-
|
|
65
|
-
"@rsbuild/
|
|
66
|
-
"@rsbuild/shared": "0.0.
|
|
62
|
+
"@rsbuild/babel-preset": "0.0.16",
|
|
63
|
+
"@rsbuild/core": "0.0.16",
|
|
64
|
+
"@rsbuild/plugin-babel": "0.0.16",
|
|
65
|
+
"@rsbuild/plugin-css-minimizer": "0.0.16",
|
|
66
|
+
"@rsbuild/shared": "0.0.16"
|
|
67
67
|
},
|
|
68
68
|
"devDependencies": {
|
|
69
69
|
"@types/lodash": "^4.14.200",
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"react": "^18.2.0",
|
|
72
72
|
"react-dom": "^18.2.0",
|
|
73
73
|
"typescript": "^5.2.2",
|
|
74
|
-
"@rsbuild/test-helper": "0.0.
|
|
74
|
+
"@rsbuild/test-helper": "0.0.16"
|
|
75
75
|
},
|
|
76
76
|
"engines": {
|
|
77
77
|
"node": ">=14.0.0"
|