@workleap/rsbuild-configs 2.0.0 → 2.0.1
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/dist/dev.js +3 -2
- package/dist/dev.js.map +1 -1
- package/package.json +1 -1
- package/src/dev.ts +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @workleap/rsbuild-configs
|
|
2
2
|
|
|
3
|
+
## 2.0.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#254](https://github.com/workleap/wl-web-configs/pull/254) [`b3a6ddf`](https://github.com/workleap/wl-web-configs/commit/b3a6ddfcb60e0f5d43b44f971601220ad17249ab) Thanks [@patricklafrance](https://github.com/patricklafrance)! - Change rsbuild dev config default `assetPrefix` value to `/`.
|
|
8
|
+
|
|
3
9
|
## 2.0.0
|
|
4
10
|
|
|
5
11
|
### Major Changes
|
package/dist/dev.js
CHANGED
|
@@ -40,7 +40,7 @@ function defineSvgrPluginConfig(options) {
|
|
|
40
40
|
function defineDevConfig(options = {}) {
|
|
41
41
|
const { entry = {
|
|
42
42
|
index: __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].resolve("./src/index.tsx")
|
|
43
|
-
}, https = false, host = "localhost", port = 8080, assetPrefix, plugins = [], html = defaultDefineHtmlPluginConfig, lazyCompilation = true, hmr = true, fastRefresh = true, sourceMap = {
|
|
43
|
+
}, https = false, host = "localhost", port = 8080, assetPrefix = "/", plugins = [], html = defaultDefineHtmlPluginConfig, lazyCompilation = true, hmr = true, fastRefresh = true, sourceMap = {
|
|
44
44
|
js: "cheap-module-source-map",
|
|
45
45
|
css: true
|
|
46
46
|
}, overlay, writeToDisk, react = defaultDefineReactPluginConfig, svgr = defineSvgrPluginConfig, // Using an empty object literal as the default value to ensure
|
|
@@ -49,7 +49,8 @@ function defineDevConfig(options = {}) {
|
|
|
49
49
|
const config = {
|
|
50
50
|
mode: "development",
|
|
51
51
|
dev: {
|
|
52
|
-
assetPrefix: assetPrefix ?? `${https ? "https" : "http"}://${host}:${port}`,
|
|
52
|
+
// assetPrefix: assetPrefix ?? `${https ? "https" : "http"}://${host}:${port}`,
|
|
53
|
+
assetPrefix,
|
|
53
54
|
lazyCompilation,
|
|
54
55
|
hmr: hmr || fastRefresh,
|
|
55
56
|
client: overlay === false || fastRefresh ? {
|
package/dist/dev.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dev.js","sources":["webpack://@workleap/rsbuild-configs/./src/dev.ts"],"sourcesContent":["import { defineConfig, type HtmlConfig, type RsbuildConfig, type RsbuildEntry, type RsbuildPlugins, type ServerConfig, type SourceMap } from \"@rsbuild/core\";\nimport { pluginBasicSsl } from \"@rsbuild/plugin-basic-ssl\";\nimport { pluginReact, type PluginReactOptions } from \"@rsbuild/plugin-react\";\nimport { pluginSvgr, type PluginSvgrOptions } from \"@rsbuild/plugin-svgr\";\nimport path from \"node:path\";\nimport { applyTransformers, type RsbuildConfigTransformer } from \"./applyTransformers.ts\";\nimport { isBoolean } from \"./assertions.ts\";\n\nexport type DefineDevHtmlPluginConfigFunction = (defaultOptions: HtmlConfig) => HtmlConfig;\nexport type DefineDevDefineReactPluginConfigFunction = (defaultOptions: PluginReactOptions) => PluginReactOptions;\nexport type DefineDevSvgrPluginConfigFunction = (defaultOptions: PluginSvgrOptions) => PluginSvgrOptions;\n\nexport interface DefineDevConfigOptions {\n entry?: RsbuildEntry;\n https?: boolean | ServerConfig[\"https\"];\n host?: string;\n port?: number;\n // Similar to webpack.publicPath.\n assetPrefix?: string;\n plugins?: RsbuildPlugins;\n html?: false | DefineDevHtmlPluginConfigFunction;\n lazyCompilation?: boolean;\n hmr?: boolean;\n fastRefresh?: boolean;\n sourceMap?: false | SourceMap;\n overlay?: false;\n writeToDisk?: true;\n react?: false | DefineDevDefineReactPluginConfigFunction;\n svgr? : false | DefineDevSvgrPluginConfigFunction;\n environmentVariables?: Record<string, unknown>;\n transformers?: RsbuildConfigTransformer[];\n verbose?: boolean;\n}\n\nfunction defaultDefineHtmlPluginConfig(options: HtmlConfig) {\n return options;\n}\n\nfunction defaultDefineReactPluginConfig(options: PluginReactOptions) {\n return options;\n}\n\nfunction defineSvgrPluginConfig(options: PluginSvgrOptions) {\n return options;\n}\n\nexport function defineDevConfig(options: DefineDevConfigOptions = {}) {\n const {\n entry = {\n index: path.resolve(\"./src/index.tsx\")\n },\n https = false,\n host = \"localhost\",\n port = 8080,\n assetPrefix,\n plugins = [],\n html = defaultDefineHtmlPluginConfig,\n lazyCompilation = true,\n hmr = true,\n fastRefresh = true,\n sourceMap = {\n js: \"cheap-module-source-map\",\n css: true\n },\n overlay,\n writeToDisk,\n react = defaultDefineReactPluginConfig,\n svgr = defineSvgrPluginConfig,\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: RsbuildConfig = {\n mode: \"development\",\n dev: {\n assetPrefix: assetPrefix ?? `${https ? \"https\" : \"http\"}://${host}:${port}`,\n lazyCompilation,\n hmr: hmr || fastRefresh,\n client: (overlay === false || fastRefresh) ? {\n overlay: false\n } : undefined,\n writeToDisk\n },\n server: {\n https: isBoolean(https) ? undefined : https,\n host,\n port,\n historyApiFallback: true\n },\n source: {\n entry,\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://rsbuild.dev/guide/advanced/env-vars#using-define.\n define: {\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 },\n output: {\n target: \"web\",\n minify: false,\n sourceMap\n },\n html: html\n ? html({ template: path.resolve(\"./public/index.html\") })\n : undefined,\n plugins: [\n isBoolean(https) && https && pluginBasicSsl(),\n react && pluginReact(react({\n fastRefresh,\n reactRefreshOptions: {\n overlay: overlay !== false\n }\n })),\n svgr && pluginSvgr(svgr({\n svgrOptions: {\n exportType: \"named\"\n }\n })),\n ...plugins\n ].filter(Boolean),\n tools: {\n rspack: {\n infrastructureLogging: verbose ? {\n appendOnly: true,\n level: \"verbose\",\n debug: /PackFileCache/\n } : undefined\n }\n }\n };\n\n const transformedConfig = applyTransformers(config, transformers, {\n environment: \"dev\",\n verbose\n });\n\n return defineConfig(transformedConfig);\n}\n\n"],"names":["defineConfig","pluginBasicSsl","pluginReact","pluginSvgr","path","applyTransformers","isBoolean","defaultDefineHtmlPluginConfig","options","defaultDefineReactPluginConfig","defineSvgrPluginConfig","defineDevConfig","entry","https","host","port","assetPrefix","plugins","html","lazyCompilation","hmr","fastRefresh","sourceMap","overlay","writeToDisk","react","svgr","environmentVariables","transformers","verbose","config","undefined","Object","acc","key","JSON","Boolean","transformedConfig"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAA6J;AAClG;AACkB;AACH;AAC7C;AAC6D;AAC9C;AA4B5C,SAASO,8BAA8BC,OAAmB;IACtD,OAAOA;AACX;AAEA,SAASC,+BAA+BD,OAA2B;IAC/D,OAAOA;AACX;AAEA,SAASE,uBAAuBF,OAA0B;IACtD,OAAOA;AACX;AAEO,SAASG,gBAAgBH,UAAkC,CAAC,CAAC;IAChE,MAAM,EACFI,QAAQ;QACJ,OAAOR,iEAAY,CAAC;IACxB,CAAC,EACDS,QAAQ,KAAK,EACbC,OAAO,WAAW,EAClBC,OAAO,IAAI,EACXC,
|
|
1
|
+
{"version":3,"file":"dev.js","sources":["webpack://@workleap/rsbuild-configs/./src/dev.ts"],"sourcesContent":["import { defineConfig, type HtmlConfig, type RsbuildConfig, type RsbuildEntry, type RsbuildPlugins, type ServerConfig, type SourceMap } from \"@rsbuild/core\";\nimport { pluginBasicSsl } from \"@rsbuild/plugin-basic-ssl\";\nimport { pluginReact, type PluginReactOptions } from \"@rsbuild/plugin-react\";\nimport { pluginSvgr, type PluginSvgrOptions } from \"@rsbuild/plugin-svgr\";\nimport path from \"node:path\";\nimport { applyTransformers, type RsbuildConfigTransformer } from \"./applyTransformers.ts\";\nimport { isBoolean } from \"./assertions.ts\";\n\nexport type DefineDevHtmlPluginConfigFunction = (defaultOptions: HtmlConfig) => HtmlConfig;\nexport type DefineDevDefineReactPluginConfigFunction = (defaultOptions: PluginReactOptions) => PluginReactOptions;\nexport type DefineDevSvgrPluginConfigFunction = (defaultOptions: PluginSvgrOptions) => PluginSvgrOptions;\n\nexport interface DefineDevConfigOptions {\n entry?: RsbuildEntry;\n https?: boolean | ServerConfig[\"https\"];\n host?: string;\n port?: number;\n // Similar to webpack.publicPath.\n assetPrefix?: string;\n plugins?: RsbuildPlugins;\n html?: false | DefineDevHtmlPluginConfigFunction;\n lazyCompilation?: boolean;\n hmr?: boolean;\n fastRefresh?: boolean;\n sourceMap?: false | SourceMap;\n overlay?: false;\n writeToDisk?: true;\n react?: false | DefineDevDefineReactPluginConfigFunction;\n svgr? : false | DefineDevSvgrPluginConfigFunction;\n environmentVariables?: Record<string, unknown>;\n transformers?: RsbuildConfigTransformer[];\n verbose?: boolean;\n}\n\nfunction defaultDefineHtmlPluginConfig(options: HtmlConfig) {\n return options;\n}\n\nfunction defaultDefineReactPluginConfig(options: PluginReactOptions) {\n return options;\n}\n\nfunction defineSvgrPluginConfig(options: PluginSvgrOptions) {\n return options;\n}\n\nexport function defineDevConfig(options: DefineDevConfigOptions = {}) {\n const {\n entry = {\n index: path.resolve(\"./src/index.tsx\")\n },\n https = false,\n host = \"localhost\",\n port = 8080,\n assetPrefix = \"/\",\n plugins = [],\n html = defaultDefineHtmlPluginConfig,\n lazyCompilation = true,\n hmr = true,\n fastRefresh = true,\n sourceMap = {\n js: \"cheap-module-source-map\",\n css: true\n },\n overlay,\n writeToDisk,\n react = defaultDefineReactPluginConfig,\n svgr = defineSvgrPluginConfig,\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: RsbuildConfig = {\n mode: \"development\",\n dev: {\n // assetPrefix: assetPrefix ?? `${https ? \"https\" : \"http\"}://${host}:${port}`,\n assetPrefix,\n lazyCompilation,\n hmr: hmr || fastRefresh,\n client: (overlay === false || fastRefresh) ? {\n overlay: false\n } : undefined,\n writeToDisk\n },\n server: {\n https: isBoolean(https) ? undefined : https,\n host,\n port,\n historyApiFallback: true\n },\n source: {\n entry,\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://rsbuild.dev/guide/advanced/env-vars#using-define.\n define: {\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 },\n output: {\n target: \"web\",\n minify: false,\n sourceMap\n },\n html: html\n ? html({ template: path.resolve(\"./public/index.html\") })\n : undefined,\n plugins: [\n isBoolean(https) && https && pluginBasicSsl(),\n react && pluginReact(react({\n fastRefresh,\n reactRefreshOptions: {\n overlay: overlay !== false\n }\n })),\n svgr && pluginSvgr(svgr({\n svgrOptions: {\n exportType: \"named\"\n }\n })),\n ...plugins\n ].filter(Boolean),\n tools: {\n rspack: {\n infrastructureLogging: verbose ? {\n appendOnly: true,\n level: \"verbose\",\n debug: /PackFileCache/\n } : undefined\n }\n }\n };\n\n const transformedConfig = applyTransformers(config, transformers, {\n environment: \"dev\",\n verbose\n });\n\n return defineConfig(transformedConfig);\n}\n\n"],"names":["defineConfig","pluginBasicSsl","pluginReact","pluginSvgr","path","applyTransformers","isBoolean","defaultDefineHtmlPluginConfig","options","defaultDefineReactPluginConfig","defineSvgrPluginConfig","defineDevConfig","entry","https","host","port","assetPrefix","plugins","html","lazyCompilation","hmr","fastRefresh","sourceMap","overlay","writeToDisk","react","svgr","environmentVariables","transformers","verbose","config","undefined","Object","acc","key","JSON","Boolean","transformedConfig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AAC;YACR;QACJ;QACA,QAAQ;YACJ,QAAQ;YACR,QAAQ;YACRX;QACJ;QACA,MAAMJ,OACAA,KAAK;YAAE,UAAUd,iEAAY,CAAC;QAAuB,KACrD2B;QACN,SAAS;YACLzB,iEAASA,CAACO,UAAUA,SAASZ,iFAAcA;YAC3CwB,SAASvB,0EAAWA,CAACuB,MAAM;gBACvBJ;gBACA,qBAAqB;oBACjB,SAASE,YAAY;gBACzB;YACJ;YACAG,QAAQvB,wEAAUA,CAACuB,KAAK;gBACpB,aAAa;oBACT,YAAY;gBAChB;YACJ;eACGT;SACN,CAAC,MAAM,CAACmB;QACT,OAAO;YACH,QAAQ;gBACJ,uBAAuBP,UAAU;oBAC7B,YAAY;oBACZ,OAAO;oBACP,OAAO;gBACX,IAAIE;YACR;QACJ;IACJ;IAEA,MAAMM,oBAAoBhC,gFAAiBA,CAACyB,QAAQF,cAAc;QAC9D,aAAa;QACbC;IACJ;IAEA,OAAO7B,mEAAYA,CAACqC;AACxB"}
|
package/package.json
CHANGED
package/src/dev.ts
CHANGED
|
@@ -52,7 +52,7 @@ export function defineDevConfig(options: DefineDevConfigOptions = {}) {
|
|
|
52
52
|
https = false,
|
|
53
53
|
host = "localhost",
|
|
54
54
|
port = 8080,
|
|
55
|
-
assetPrefix,
|
|
55
|
+
assetPrefix = "/",
|
|
56
56
|
plugins = [],
|
|
57
57
|
html = defaultDefineHtmlPluginConfig,
|
|
58
58
|
lazyCompilation = true,
|
|
@@ -76,7 +76,8 @@ export function defineDevConfig(options: DefineDevConfigOptions = {}) {
|
|
|
76
76
|
const config: RsbuildConfig = {
|
|
77
77
|
mode: "development",
|
|
78
78
|
dev: {
|
|
79
|
-
assetPrefix: assetPrefix ?? `${https ? "https" : "http"}://${host}:${port}`,
|
|
79
|
+
// assetPrefix: assetPrefix ?? `${https ? "https" : "http"}://${host}:${port}`,
|
|
80
|
+
assetPrefix,
|
|
80
81
|
lazyCompilation,
|
|
81
82
|
hmr: hmr || fastRefresh,
|
|
82
83
|
client: (overlay === false || fastRefresh) ? {
|