@rsbuild/webpack 0.0.21 → 0.0.22
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.
|
@@ -8,4 +8,4 @@ export declare function createCompiler({
|
|
|
8
8
|
context: Context;
|
|
9
9
|
webpackConfigs: WebpackConfig[];
|
|
10
10
|
}): Promise<Compiler | MultiCompiler>;
|
|
11
|
-
export declare function
|
|
11
|
+
export declare function createDevMiddleware(options: InitConfigsOptions, customCompiler?: Compiler | MultiCompiler): Promise<import("@rsbuild/shared").DevMiddleware>;
|
|
@@ -29,7 +29,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
29
29
|
var createCompiler_exports = {};
|
|
30
30
|
__export(createCompiler_exports, {
|
|
31
31
|
createCompiler: () => createCompiler,
|
|
32
|
-
|
|
32
|
+
createDevMiddleware: () => createDevMiddleware
|
|
33
33
|
});
|
|
34
34
|
module.exports = __toCommonJS(createCompiler_exports);
|
|
35
35
|
var import_shared = require("@rsbuild/shared");
|
|
@@ -65,7 +65,7 @@ async function createCompiler({
|
|
|
65
65
|
(0, import_shared.debug)("create compiler done");
|
|
66
66
|
return compiler;
|
|
67
67
|
}
|
|
68
|
-
async function
|
|
68
|
+
async function createDevMiddleware(options, customCompiler) {
|
|
69
69
|
let compiler;
|
|
70
70
|
if (customCompiler) {
|
|
71
71
|
compiler = customCompiler;
|
|
@@ -81,5 +81,5 @@ async function startDevCompile(options, customCompiler) {
|
|
|
81
81
|
// Annotate the CommonJS export names for ESM import in node:
|
|
82
82
|
0 && (module.exports = {
|
|
83
83
|
createCompiler,
|
|
84
|
-
|
|
84
|
+
createDevMiddleware
|
|
85
85
|
});
|
package/dist/plugins/babel.js
CHANGED
|
@@ -127,7 +127,7 @@ const pluginBabel = () => ({
|
|
|
127
127
|
includes,
|
|
128
128
|
excludes
|
|
129
129
|
});
|
|
130
|
-
rule.test(useTsLoader ? import_shared.JS_REGEX :
|
|
130
|
+
rule.test(useTsLoader ? import_shared.JS_REGEX : import_shared.SCRIPT_REGEX).use(CHAIN_ID.USE.BABEL).loader(require.resolve("babel-loader")).options(babelOptions);
|
|
131
131
|
chain.module.rule(CHAIN_ID.RULE.JS_DATA_URI).mimetype({
|
|
132
132
|
or: ["text/javascript", "application/javascript"]
|
|
133
133
|
}).use(CHAIN_ID.USE.BABEL).loader(require.resolve("babel-loader")).options(import_lodash.default.cloneDeep(babelOptions));
|
package/dist/provider.js
CHANGED
|
@@ -70,11 +70,11 @@ function webpackProvider({
|
|
|
70
70
|
return createCompiler({ context, webpackConfigs });
|
|
71
71
|
},
|
|
72
72
|
async startDevServer(options) {
|
|
73
|
-
const {
|
|
73
|
+
const { createDevMiddleware } = await Promise.resolve().then(() => __toESM(require("./core/createCompiler")));
|
|
74
74
|
return (0, import_server.startDevServer)(
|
|
75
75
|
{ context, pluginStore, rsbuildOptions },
|
|
76
76
|
// @ts-expect-error compiler type mismatch
|
|
77
|
-
|
|
77
|
+
createDevMiddleware,
|
|
78
78
|
options
|
|
79
79
|
);
|
|
80
80
|
},
|
package/dist/shared/plugin.js
CHANGED
|
@@ -60,7 +60,6 @@ const applyDefaultPlugins = (plugins) => {
|
|
|
60
60
|
Promise.resolve().then(() => __toESM(require("../plugins/css"))).then((m) => m.pluginCss()),
|
|
61
61
|
Promise.resolve().then(() => __toESM(require("../plugins/sass"))).then((m) => m.pluginSass()),
|
|
62
62
|
Promise.resolve().then(() => __toESM(require("../plugins/less"))).then((m) => m.pluginLess()),
|
|
63
|
-
plugins.rem(),
|
|
64
63
|
plugins.bundleAnalyzer(),
|
|
65
64
|
plugins.toml(),
|
|
66
65
|
plugins.yaml(),
|
|
@@ -70,9 +69,7 @@ const applyDefaultPlugins = (plugins) => {
|
|
|
70
69
|
plugins.externals(),
|
|
71
70
|
plugins.performance(),
|
|
72
71
|
plugins.networkPerformance(),
|
|
73
|
-
plugins.preloadOrPrefetch()
|
|
74
|
-
Promise.resolve().then(() => __toESM(require("../plugins/fallback"))).then((m) => m.pluginFallback())
|
|
75
|
-
// fallback should be the last plugin
|
|
72
|
+
plugins.preloadOrPrefetch()
|
|
76
73
|
]);
|
|
77
74
|
};
|
|
78
75
|
// Annotate the CommonJS export names for ESM import in node:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsbuild/webpack",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.22",
|
|
4
4
|
"homepage": "https://rsbuild.dev",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -51,11 +51,11 @@
|
|
|
51
51
|
"ts-loader": "9.4.4",
|
|
52
52
|
"tsconfig-paths-webpack-plugin": "4.1.0",
|
|
53
53
|
"webpack": "^5.89.0",
|
|
54
|
-
"@rsbuild/babel-preset": "0.0.
|
|
55
|
-
"@rsbuild/
|
|
56
|
-
"@rsbuild/
|
|
57
|
-
"@rsbuild/plugin-css-minimizer": "0.0.
|
|
58
|
-
"@rsbuild/shared": "0.0.
|
|
54
|
+
"@rsbuild/babel-preset": "0.0.22",
|
|
55
|
+
"@rsbuild/plugin-babel": "0.0.22",
|
|
56
|
+
"@rsbuild/core": "0.0.22",
|
|
57
|
+
"@rsbuild/plugin-css-minimizer": "0.0.22",
|
|
58
|
+
"@rsbuild/shared": "0.0.22"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
61
|
"@types/lodash": "^4.14.200",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"react": "^18.2.0",
|
|
64
64
|
"react-dom": "^18.2.0",
|
|
65
65
|
"typescript": "^5.2.2",
|
|
66
|
-
"@rsbuild/test-helper": "0.0.
|
|
66
|
+
"@rsbuild/test-helper": "0.0.22"
|
|
67
67
|
},
|
|
68
68
|
"engines": {
|
|
69
69
|
"node": ">=14.0.0"
|
package/dist/plugins/fallback.js
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var fallback_exports = {};
|
|
20
|
-
__export(fallback_exports, {
|
|
21
|
-
pluginFallback: () => pluginFallback
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(fallback_exports);
|
|
24
|
-
var import_path = require("path");
|
|
25
|
-
var import_shared = require("@rsbuild/shared");
|
|
26
|
-
const pluginFallback = () => ({
|
|
27
|
-
name: "plugin-fallback",
|
|
28
|
-
setup(api) {
|
|
29
|
-
api.modifyWebpackChain((chain, { isProd }) => {
|
|
30
|
-
const rsbuildConfig = api.getNormalizedConfig();
|
|
31
|
-
if (rsbuildConfig.output.enableAssetFallback) {
|
|
32
|
-
const distDir = (0, import_shared.getDistPath)(rsbuildConfig.output, "media");
|
|
33
|
-
const filename = (0, import_shared.getFilename)(rsbuildConfig.output, "media", isProd);
|
|
34
|
-
chain.output.merge({
|
|
35
|
-
assetModuleFilename: (0, import_path.join)(distDir, filename)
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
api.modifyWebpackConfig((config) => {
|
|
40
|
-
const rsbuildConfig = api.getNormalizedConfig();
|
|
41
|
-
if (!rsbuildConfig.output.enableAssetFallback || !config.module) {
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
config.module.rules = (0, import_shared.resourceRuleFallback)(config.module.rules);
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
49
|
-
0 && (module.exports = {
|
|
50
|
-
pluginFallback
|
|
51
|
-
});
|