@rsbuild/core 0.0.16 → 0.0.17
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/dist/plugins/define.js +24 -26
- package/dist/plugins/html.d.ts +7 -1
- package/dist/plugins/html.js +72 -48
- package/dist/plugins/startUrl.js +1 -1
- package/dist/rspack-plugins/HtmlBasicPlugin.d.ts +19 -0
- package/dist/rspack-plugins/HtmlBasicPlugin.js +87 -0
- package/dist/rspack-provider/plugins/css.js +2 -2
- package/dist/rspack-provider/plugins/less.js +1 -1
- package/dist/rspack-provider/plugins/resolve.js +1 -2
- package/dist/rspack-provider/plugins/sass.js +2 -2
- package/dist/rspack-provider/plugins/swc.js +3 -5
- package/package.json +3 -3
- package/static/template.html +7 -0
- package/dist/utils/generateMetaTags.d.ts +0 -0
- package/dist/utils/generateMetaTags.js +0 -1
package/dist/plugins/define.js
CHANGED
|
@@ -25,32 +25,30 @@ var import_lodash = require("lodash");
|
|
|
25
25
|
var import_shared = require("@rsbuild/shared");
|
|
26
26
|
const pluginDefine = () => ({
|
|
27
27
|
name: "plugin-define",
|
|
28
|
-
|
|
29
|
-
api.modifyBundlerChain(
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}
|
|
53
|
-
);
|
|
28
|
+
setup(api) {
|
|
29
|
+
api.modifyBundlerChain((chain, { env, target, CHAIN_ID, bundler }) => {
|
|
30
|
+
const config = api.getNormalizedConfig();
|
|
31
|
+
const publicPath = chain.output.get("publicPath");
|
|
32
|
+
const assetPrefix = publicPath && typeof publicPath === "string" ? publicPath : config.output.assetPrefix;
|
|
33
|
+
const builtinVars = {
|
|
34
|
+
"process.env.NODE_ENV": process.env.NODE_ENV,
|
|
35
|
+
"process.env.ASSET_PREFIX": (0, import_shared.removeTailSlash)(assetPrefix)
|
|
36
|
+
};
|
|
37
|
+
const globalVars = (0, import_shared.mergeChainedOptions)({
|
|
38
|
+
defaults: builtinVars,
|
|
39
|
+
options: config.source.globalVars,
|
|
40
|
+
utils: { env, target }
|
|
41
|
+
});
|
|
42
|
+
const serializedVars = (0, import_lodash.mapValues)(
|
|
43
|
+
globalVars,
|
|
44
|
+
(value) => {
|
|
45
|
+
var _a;
|
|
46
|
+
return (_a = JSON.stringify(value)) != null ? _a : "undefined";
|
|
47
|
+
}
|
|
48
|
+
);
|
|
49
|
+
const defineExprs = config.source.define;
|
|
50
|
+
chain.plugin(CHAIN_ID.PLUGIN.DEFINE).use(bundler.DefinePlugin, [{ ...serializedVars, ...defineExprs }]);
|
|
51
|
+
});
|
|
54
52
|
}
|
|
55
53
|
});
|
|
56
54
|
// Annotate the CommonJS export names for ESM import in node:
|
package/dist/plugins/html.d.ts
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import type { MetaAttrs, HtmlConfig, MetaOptions, DefaultRsbuildPlugin, SharedRsbuildPluginAPI, NormalizedOutputConfig } from '@rsbuild/shared';
|
|
1
|
+
import type { MetaAttrs, HtmlConfig, MetaOptions, NormalizedConfig, DefaultRsbuildPlugin, SharedRsbuildPluginAPI, NormalizedOutputConfig } from '@rsbuild/shared';
|
|
2
|
+
export declare function getTitle(entryName: string, config: NormalizedConfig): string;
|
|
3
|
+
export declare function getInject(entryName: string, config: NormalizedConfig): import("@rsbuild/shared").ScriptInject;
|
|
4
|
+
export declare function getTemplatePath(entryName: string, config: NormalizedConfig): string;
|
|
5
|
+
export declare function getFavicon(entryName: string, config: {
|
|
6
|
+
html: HtmlConfig;
|
|
7
|
+
}): string;
|
|
2
8
|
export declare const generateMetaTags: (metaOptions?: MetaOptions) => MetaAttrs[];
|
|
3
9
|
export declare function getMetaTags(entryName: string, config: {
|
|
4
10
|
html: HtmlConfig;
|
package/dist/plugins/html.js
CHANGED
|
@@ -30,7 +30,11 @@ var html_exports = {};
|
|
|
30
30
|
__export(html_exports, {
|
|
31
31
|
applyInjectTags: () => applyInjectTags,
|
|
32
32
|
generateMetaTags: () => generateMetaTags,
|
|
33
|
+
getFavicon: () => getFavicon,
|
|
34
|
+
getInject: () => getInject,
|
|
33
35
|
getMetaTags: () => getMetaTags,
|
|
36
|
+
getTemplatePath: () => getTemplatePath,
|
|
37
|
+
getTitle: () => getTitle,
|
|
34
38
|
pluginHtml: () => pluginHtml
|
|
35
39
|
});
|
|
36
40
|
module.exports = __toCommonJS(html_exports);
|
|
@@ -38,6 +42,43 @@ var import_path = __toESM(require("path"));
|
|
|
38
42
|
var import_shared = require("@rsbuild/shared");
|
|
39
43
|
var import_fs_extra = require("@rsbuild/shared/fs-extra");
|
|
40
44
|
var import_lodash = __toESM(require("lodash"));
|
|
45
|
+
var import_HtmlBasicPlugin = require("../rspack-plugins/HtmlBasicPlugin");
|
|
46
|
+
function getTitle(entryName, config) {
|
|
47
|
+
return (0, import_shared.mergeChainedOptions)({
|
|
48
|
+
defaults: "",
|
|
49
|
+
options: config.html.title,
|
|
50
|
+
utils: { entryName },
|
|
51
|
+
useObjectParam: true
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
function getInject(entryName, config) {
|
|
55
|
+
return (0, import_shared.mergeChainedOptions)({
|
|
56
|
+
defaults: "head",
|
|
57
|
+
options: config.html.inject,
|
|
58
|
+
utils: { entryName },
|
|
59
|
+
useObjectParam: true
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
function getTemplatePath(entryName, config) {
|
|
63
|
+
const DEFAULT_TEMPLATE = import_path.default.resolve(
|
|
64
|
+
__dirname,
|
|
65
|
+
"../../static/template.html"
|
|
66
|
+
);
|
|
67
|
+
return (0, import_shared.mergeChainedOptions)({
|
|
68
|
+
defaults: DEFAULT_TEMPLATE,
|
|
69
|
+
options: config.html.template,
|
|
70
|
+
utils: { entryName },
|
|
71
|
+
useObjectParam: true
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
function getFavicon(entryName, config) {
|
|
75
|
+
return (0, import_shared.mergeChainedOptions)({
|
|
76
|
+
defaults: "",
|
|
77
|
+
options: config.html.favicon,
|
|
78
|
+
utils: { entryName },
|
|
79
|
+
useObjectParam: true
|
|
80
|
+
});
|
|
81
|
+
}
|
|
41
82
|
const generateMetaTags = (metaOptions) => {
|
|
42
83
|
if (!metaOptions) {
|
|
43
84
|
return [];
|
|
@@ -59,32 +100,29 @@ async function getMetaTags(entryName, config) {
|
|
|
59
100
|
});
|
|
60
101
|
return generateMetaTags(merged);
|
|
61
102
|
}
|
|
62
|
-
|
|
63
|
-
const { mountId, templateParameters, templateParametersByEntries } = config.html;
|
|
64
|
-
const templateParams = (templateParametersByEntries == null ? void 0 : templateParametersByEntries[entryName]) || templateParameters;
|
|
65
|
-
const baseParameters = {
|
|
66
|
-
mountId,
|
|
67
|
-
entryName,
|
|
68
|
-
assetPrefix
|
|
69
|
-
};
|
|
103
|
+
function getTemplateParameters(entryName, config, assetPrefix) {
|
|
70
104
|
return (compilation, assets, assetTags, pluginOptions) => {
|
|
105
|
+
const { mountId, templateParameters } = config.html;
|
|
71
106
|
const defaultOptions = {
|
|
107
|
+
mountId,
|
|
108
|
+
entryName,
|
|
109
|
+
assetPrefix,
|
|
72
110
|
compilation,
|
|
73
111
|
webpackConfig: compilation.options,
|
|
74
112
|
htmlWebpackPlugin: {
|
|
75
113
|
tags: assetTags,
|
|
76
114
|
files: assets,
|
|
77
115
|
options: pluginOptions
|
|
78
|
-
}
|
|
79
|
-
...baseParameters
|
|
116
|
+
}
|
|
80
117
|
};
|
|
81
118
|
return (0, import_shared.mergeChainedOptions)({
|
|
82
119
|
defaults: defaultOptions,
|
|
83
|
-
options:
|
|
120
|
+
options: templateParameters,
|
|
121
|
+
utils: { entryName }
|
|
84
122
|
});
|
|
85
123
|
};
|
|
86
124
|
}
|
|
87
|
-
|
|
125
|
+
function getChunks(entryName, entryValue) {
|
|
88
126
|
const dependOn = [];
|
|
89
127
|
if ((0, import_shared.isPlainObject)(entryValue)) {
|
|
90
128
|
dependOn.push(...entryValue.dependOn);
|
|
@@ -139,36 +177,19 @@ const pluginHtml = () => ({
|
|
|
139
177
|
const entries = chain.entryPoints.entries() || {};
|
|
140
178
|
const entryNames = Object.keys(entries);
|
|
141
179
|
const htmlPaths = api.getHTMLPaths();
|
|
142
|
-
const
|
|
143
|
-
const metaPluginOptions = {
|
|
144
|
-
meta: {},
|
|
145
|
-
HtmlPlugin
|
|
146
|
-
};
|
|
147
|
-
const titlePluginOptions = {
|
|
148
|
-
titles: {},
|
|
149
|
-
HtmlPlugin
|
|
150
|
-
};
|
|
180
|
+
const htmlInfoMap = {};
|
|
151
181
|
await Promise.all(
|
|
152
182
|
entryNames.map(async (entryName, index) => {
|
|
153
183
|
const entryValue = entries[entryName].values();
|
|
154
|
-
const chunks =
|
|
155
|
-
const inject =
|
|
156
|
-
const favicon = (0, import_shared.getFavicon)(entryName, config);
|
|
184
|
+
const chunks = getChunks(entryName, entryValue);
|
|
185
|
+
const inject = getInject(entryName, config);
|
|
157
186
|
const filename = htmlPaths[entryName];
|
|
158
|
-
const template =
|
|
159
|
-
const
|
|
160
|
-
const title = await (0, import_shared.getTitle)(entryName, config);
|
|
161
|
-
const templateParameters = await getTemplateParameters(
|
|
187
|
+
const template = getTemplatePath(entryName, config);
|
|
188
|
+
const templateParameters = getTemplateParameters(
|
|
162
189
|
entryName,
|
|
163
190
|
config,
|
|
164
191
|
assetPrefix
|
|
165
192
|
);
|
|
166
|
-
if (metaTags.length) {
|
|
167
|
-
metaPluginOptions.meta[filename] = metaTags;
|
|
168
|
-
}
|
|
169
|
-
if (title) {
|
|
170
|
-
titlePluginOptions.titles[filename] = title;
|
|
171
|
-
}
|
|
172
193
|
const pluginOptions = {
|
|
173
194
|
chunks,
|
|
174
195
|
inject,
|
|
@@ -178,12 +199,20 @@ const pluginHtml = () => ({
|
|
|
178
199
|
templateParameters,
|
|
179
200
|
scriptLoading: config.html.scriptLoading
|
|
180
201
|
};
|
|
202
|
+
const htmlInfo = {};
|
|
203
|
+
htmlInfoMap[filename] = htmlInfo;
|
|
204
|
+
const title = getTitle(entryName, config);
|
|
205
|
+
if (title) {
|
|
206
|
+
htmlInfo.title = title;
|
|
207
|
+
}
|
|
208
|
+
const metaTags = await getMetaTags(entryName, config);
|
|
209
|
+
if (metaTags.length) {
|
|
210
|
+
htmlInfo.meta = metaTags;
|
|
211
|
+
}
|
|
212
|
+
const favicon = getFavicon(entryName, config);
|
|
181
213
|
if (favicon) {
|
|
182
214
|
if ((0, import_shared.isURL)(favicon)) {
|
|
183
|
-
|
|
184
|
-
filename,
|
|
185
|
-
url: favicon
|
|
186
|
-
});
|
|
215
|
+
htmlInfo.favicon = favicon;
|
|
187
216
|
} else {
|
|
188
217
|
pluginOptions.favicon = favicon;
|
|
189
218
|
}
|
|
@@ -205,12 +234,7 @@ const pluginHtml = () => ({
|
|
|
205
234
|
chain.plugin(`${CHAIN_ID.PLUGIN.HTML}-${entryName}`).use(HtmlPlugin, [finalOptions]);
|
|
206
235
|
})
|
|
207
236
|
);
|
|
208
|
-
|
|
209
|
-
chain.plugin(CHAIN_ID.PLUGIN.HTML_META).use(import_shared.HtmlMetaPlugin, [metaPluginOptions]);
|
|
210
|
-
}
|
|
211
|
-
if (Object.keys(titlePluginOptions.titles).length) {
|
|
212
|
-
chain.plugin(CHAIN_ID.PLUGIN.HTML_TITLE).use(import_shared.HtmlTitlePlugin, [titlePluginOptions]);
|
|
213
|
-
}
|
|
237
|
+
chain.plugin(CHAIN_ID.PLUGIN.HTML_BASIC).use(import_HtmlBasicPlugin.HtmlBasicPlugin, [{ HtmlPlugin, info: htmlInfoMap }]);
|
|
214
238
|
if (config.security) {
|
|
215
239
|
const { nonce } = config.security;
|
|
216
240
|
if (nonce) {
|
|
@@ -228,10 +252,6 @@ const pluginHtml = () => ({
|
|
|
228
252
|
]);
|
|
229
253
|
chain.output.crossOriginLoading(formattedCrossorigin);
|
|
230
254
|
}
|
|
231
|
-
if (faviconUrls.length) {
|
|
232
|
-
const { HtmlFaviconUrlPlugin } = await Promise.resolve().then(() => __toESM(require("@rsbuild/shared")));
|
|
233
|
-
chain.plugin(CHAIN_ID.PLUGIN.FAVICON_URL).use(HtmlFaviconUrlPlugin, [{ faviconUrls, HtmlPlugin }]);
|
|
234
|
-
}
|
|
235
255
|
if (appIcon) {
|
|
236
256
|
const { HtmlAppIconPlugin } = await Promise.resolve().then(() => __toESM(require("@rsbuild/shared")));
|
|
237
257
|
const distDir = (0, import_shared.getDistPath)(config.output, "image");
|
|
@@ -259,6 +279,10 @@ const pluginHtml = () => ({
|
|
|
259
279
|
0 && (module.exports = {
|
|
260
280
|
applyInjectTags,
|
|
261
281
|
generateMetaTags,
|
|
282
|
+
getFavicon,
|
|
283
|
+
getInject,
|
|
262
284
|
getMetaTags,
|
|
285
|
+
getTemplatePath,
|
|
286
|
+
getTitle,
|
|
263
287
|
pluginHtml
|
|
264
288
|
});
|
package/dist/plugins/startUrl.js
CHANGED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type HtmlWebpackPlugin from 'html-webpack-plugin';
|
|
2
|
+
import type { Compiler } from '@rspack/core';
|
|
3
|
+
import type { MetaAttrs } from '@rsbuild/shared';
|
|
4
|
+
export type HtmlInfo = {
|
|
5
|
+
meta?: MetaAttrs[];
|
|
6
|
+
title?: string;
|
|
7
|
+
favicon?: string;
|
|
8
|
+
};
|
|
9
|
+
export type HtmlBasicPluginOptions = {
|
|
10
|
+
info: Record<string, HtmlInfo>;
|
|
11
|
+
HtmlPlugin: typeof HtmlWebpackPlugin;
|
|
12
|
+
};
|
|
13
|
+
export declare class HtmlBasicPlugin {
|
|
14
|
+
readonly name: string;
|
|
15
|
+
readonly options: HtmlBasicPluginOptions;
|
|
16
|
+
readonly HtmlPlugin: typeof HtmlWebpackPlugin;
|
|
17
|
+
constructor(options: HtmlBasicPluginOptions);
|
|
18
|
+
apply(compiler: Compiler): void;
|
|
19
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
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 HtmlBasicPlugin_exports = {};
|
|
20
|
+
__export(HtmlBasicPlugin_exports, {
|
|
21
|
+
HtmlBasicPlugin: () => HtmlBasicPlugin
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(HtmlBasicPlugin_exports);
|
|
24
|
+
class HtmlBasicPlugin {
|
|
25
|
+
constructor(options) {
|
|
26
|
+
this.name = "HtmlBasicPlugin";
|
|
27
|
+
this.options = options;
|
|
28
|
+
this.HtmlPlugin = options.HtmlPlugin;
|
|
29
|
+
}
|
|
30
|
+
apply(compiler) {
|
|
31
|
+
const addTitleTag = (headTags, outputName) => {
|
|
32
|
+
const { title } = this.options.info[outputName];
|
|
33
|
+
if (title) {
|
|
34
|
+
headTags.unshift({
|
|
35
|
+
tagName: "title",
|
|
36
|
+
innerHTML: title,
|
|
37
|
+
attributes: {},
|
|
38
|
+
voidTag: false,
|
|
39
|
+
meta: {}
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
const addMetaTag = (headTags, outputName) => {
|
|
44
|
+
const { meta } = this.options.info[outputName];
|
|
45
|
+
if (meta) {
|
|
46
|
+
headTags.unshift(
|
|
47
|
+
...meta.map((attr) => ({
|
|
48
|
+
tagName: "meta",
|
|
49
|
+
attributes: attr,
|
|
50
|
+
meta: {},
|
|
51
|
+
voidTag: true
|
|
52
|
+
}))
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
const addFavicon = (headTags, outputName) => {
|
|
57
|
+
const { favicon } = this.options.info[outputName];
|
|
58
|
+
if (favicon) {
|
|
59
|
+
headTags.unshift({
|
|
60
|
+
tagName: "link",
|
|
61
|
+
voidTag: true,
|
|
62
|
+
attributes: {
|
|
63
|
+
rel: "icon",
|
|
64
|
+
href: favicon
|
|
65
|
+
},
|
|
66
|
+
meta: {}
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
compiler.hooks.compilation.tap(this.name, (compilation) => {
|
|
71
|
+
this.HtmlPlugin.getHooks(compilation).alterAssetTagGroups.tap(
|
|
72
|
+
this.name,
|
|
73
|
+
(data) => {
|
|
74
|
+
const { headTags, outputName } = data;
|
|
75
|
+
addTitleTag(headTags, outputName);
|
|
76
|
+
addMetaTag(headTags, outputName);
|
|
77
|
+
addFavicon(headTags, outputName);
|
|
78
|
+
return data;
|
|
79
|
+
}
|
|
80
|
+
);
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
85
|
+
0 && (module.exports = {
|
|
86
|
+
HtmlBasicPlugin
|
|
87
|
+
});
|
|
@@ -56,7 +56,7 @@ async function applyBaseCSSRule({
|
|
|
56
56
|
const enableCssMinify = !enableExtractCSS && isProd;
|
|
57
57
|
if (!enableNativeCss(config)) {
|
|
58
58
|
const localIdentName = (0, import_shared.getCssModuleLocalIdentName)(config, isProd);
|
|
59
|
-
const cssLoaderOptions =
|
|
59
|
+
const cssLoaderOptions = (0, import_shared.getCssLoaderOptions)({
|
|
60
60
|
config,
|
|
61
61
|
enableSourceMap,
|
|
62
62
|
importLoaders,
|
|
@@ -110,7 +110,7 @@ async function applyBaseCSSRule({
|
|
|
110
110
|
rule.type("css");
|
|
111
111
|
}
|
|
112
112
|
if (!isServer && !isWebWorker) {
|
|
113
|
-
const postcssLoaderOptions =
|
|
113
|
+
const postcssLoaderOptions = (0, import_shared.getPostcssConfig)({
|
|
114
114
|
enableSourceMap,
|
|
115
115
|
browserslist,
|
|
116
116
|
config,
|
|
@@ -47,7 +47,7 @@ function pluginLess() {
|
|
|
47
47
|
context: api.context,
|
|
48
48
|
importLoaders: 2
|
|
49
49
|
});
|
|
50
|
-
const { excludes, options } =
|
|
50
|
+
const { excludes, options } = (0, import_shared.getLessLoaderOptions)(
|
|
51
51
|
config.tools.less,
|
|
52
52
|
(0, import_shared.isUseCssSourceMap)(config)
|
|
53
53
|
);
|
|
@@ -27,8 +27,7 @@ const pluginResolve = () => ({
|
|
|
27
27
|
setup(api) {
|
|
28
28
|
(0, import_shared.applyResolvePlugin)(api);
|
|
29
29
|
api.modifyBundlerChain(async (chain, { CHAIN_ID }) => {
|
|
30
|
-
|
|
31
|
-
if (chain.module.rules.get(CHAIN_ID.RULE.JS_DATA_URI) && config.source.compileJsDataURI) {
|
|
30
|
+
if (chain.module.rules.get(CHAIN_ID.RULE.JS_DATA_URI)) {
|
|
32
31
|
chain.module.rule(CHAIN_ID.RULE.JS_DATA_URI).resolve.set("fullySpecified", false);
|
|
33
32
|
}
|
|
34
33
|
});
|
|
@@ -35,14 +35,14 @@ var import_shared = require("@rsbuild/shared");
|
|
|
35
35
|
function pluginSass() {
|
|
36
36
|
return {
|
|
37
37
|
name: "plugin-sass",
|
|
38
|
-
|
|
38
|
+
setup(api) {
|
|
39
39
|
api.onAfterCreateCompiler(({ compiler }) => {
|
|
40
40
|
(0, import_shared.patchCompilerGlobalLocation)(compiler);
|
|
41
41
|
});
|
|
42
42
|
api.modifyBundlerChain(async (chain, utils) => {
|
|
43
43
|
const config = api.getNormalizedConfig();
|
|
44
44
|
const { applyBaseCSSRule } = await Promise.resolve().then(() => __toESM(require("./css")));
|
|
45
|
-
const { excludes, options } =
|
|
45
|
+
const { excludes, options } = (0, import_shared.getSassLoaderOptions)(
|
|
46
46
|
config.tools.sass,
|
|
47
47
|
// source-maps required for loaders preceding resolve-url-loader
|
|
48
48
|
true
|
|
@@ -98,11 +98,9 @@ const pluginSwc = () => ({
|
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
100
|
rule.use(CHAIN_ID.USE.SWC).loader(builtinSwcLoaderName).options(swcConfig);
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
}).use(CHAIN_ID.USE.SWC).loader(builtinSwcLoaderName).options((0, import_lodash.cloneDeep)(swcConfig));
|
|
105
|
-
}
|
|
101
|
+
chain.module.rule(CHAIN_ID.RULE.JS_DATA_URI).mimetype({
|
|
102
|
+
or: ["text/javascript", "application/javascript"]
|
|
103
|
+
}).use(CHAIN_ID.USE.SWC).loader(builtinSwcLoaderName).options((0, import_lodash.cloneDeep)(swcConfig));
|
|
106
104
|
}
|
|
107
105
|
);
|
|
108
106
|
api.modifyRspackConfig(async (config) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsbuild/core",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.17",
|
|
4
4
|
"description": "Unleash the power of Rspack with the out-of-the-box build tool.",
|
|
5
5
|
"homepage": "https://rsbuild.dev",
|
|
6
6
|
"bugs": {
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
],
|
|
63
63
|
"dependencies": {
|
|
64
64
|
"@modern-js/server": "0.0.0-next-20231103131234",
|
|
65
|
-
"@rspack/core": "0.3.
|
|
65
|
+
"@rspack/core": "0.3.11",
|
|
66
66
|
"commander": "^10.0.1",
|
|
67
67
|
"core-js": "~3.32.2",
|
|
68
68
|
"filesize": "^8.0.7",
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
"pkg-up": "^3.1.0",
|
|
75
75
|
"postcss": "8.4.31",
|
|
76
76
|
"semver": "^7.5.4",
|
|
77
|
-
"@rsbuild/shared": "0.0.
|
|
77
|
+
"@rsbuild/shared": "0.0.17"
|
|
78
78
|
},
|
|
79
79
|
"devDependencies": {
|
|
80
80
|
"@types/lodash": "^4.14.200",
|
|
File without changes
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|