Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: rename normalizedConfig to config
Browse files Browse the repository at this point in the history
9aoy committed Jun 28, 2024
1 parent 1e5b0b1 commit dffaa6a
Showing 46 changed files with 75 additions and 75 deletions.
8 changes: 4 additions & 4 deletions packages/compat/plugin-swc/src/minimizer.ts
Original file line number Diff line number Diff line change
@@ -37,12 +37,12 @@ export class SwcMinimizerPlugin {
constructor(options: {
jsMinify?: boolean | JsMinifyOptions;
cssMinify?: boolean | CssMinifyOptions;
rsbuildConfig: NormalizedEnvironmentConfig;
environmentConfig: NormalizedEnvironmentConfig;
}) {
this.minifyOptions = {
jsMinify: options.jsMinify
? deepmerge(
this.getDefaultJsMinifyOptions(options.rsbuildConfig),
this.getDefaultJsMinifyOptions(options.environmentConfig),
normalize(options.jsMinify, {}),
)
: undefined,
@@ -53,10 +53,10 @@ export class SwcMinimizerPlugin {
}

getDefaultJsMinifyOptions(
rsbuildConfig: NormalizedEnvironmentConfig,
environmentConfig: NormalizedEnvironmentConfig,
): JsMinifyOptions {
const options = {
...__internalHelper.getSwcMinimizerOptions(rsbuildConfig),
...__internalHelper.getSwcMinimizerOptions(environmentConfig),
mangle: true,
};

16 changes: 8 additions & 8 deletions packages/compat/plugin-swc/src/plugin.ts
Original file line number Diff line number Diff line change
@@ -36,13 +36,13 @@ export const pluginSwc = (options: PluginSwcOptions = {}): RsbuildPlugin => ({
order: 'pre',
handler: async (chain, utils) => {
const { CHAIN_ID, environment } = utils;
const { normalizedConfig: rsbuildConfig, browserslist } = environment;
const { config: environmentConfig, browserslist } = environment;
const { rootPath } = api.context;

const swcConfigs = await applyPluginConfig(
options,
utils,
rsbuildConfig,
environmentConfig,
rootPath,
browserslist,
);
@@ -55,7 +55,7 @@ export const pluginSwc = (options: PluginSwcOptions = {}): RsbuildPlugin => ({
applyScriptCondition({
rule: chain.module.rule(CHAIN_ID.RULE.JS),
chain,
config: rsbuildConfig,
config: environmentConfig,
context: api.context,
includes: [],
excludes: [],
@@ -115,10 +115,10 @@ export const pluginSwc = (options: PluginSwcOptions = {}): RsbuildPlugin => ({
});

api.modifyBundlerChain((chain, { CHAIN_ID, isProd, environment }) => {
const rsbuildConfig = environment.normalizedConfig;
const environmentConfig = environment.config;

if (checkUseMinify(mainConfig, rsbuildConfig, isProd)) {
const { minify } = rsbuildConfig.output;
if (checkUseMinify(mainConfig, environmentConfig, isProd)) {
const { minify } = environmentConfig.output;
const minifyJs =
minify === true || (typeof minify === 'object' && minify.js);
const minifyCss =
@@ -130,7 +130,7 @@ export const pluginSwc = (options: PluginSwcOptions = {}): RsbuildPlugin => ({
.use(SwcMinimizerPlugin, [
{
jsMinify: mainConfig.jsMinify ?? mainConfig.jsc?.minify ?? true,
rsbuildConfig,
environmentConfig,
},
]);
}
@@ -141,7 +141,7 @@ export const pluginSwc = (options: PluginSwcOptions = {}): RsbuildPlugin => ({
.use(SwcMinimizerPlugin, [
{
cssMinify: minifyCss ? mainConfig.cssMinify ?? true : false,
rsbuildConfig,
environmentConfig,
},
]);
}
2 changes: 1 addition & 1 deletion packages/compat/webpack/src/plugin.ts
Original file line number Diff line number Diff line change
@@ -61,7 +61,7 @@ export const pluginAdaptor = (): RsbuildPlugin => ({

setup(api) {
api.modifyBundlerChain(async (chain, { CHAIN_ID, environment, target }) => {
const { normalizedConfig: config, tsconfigPath } = environment;
const { config, tsconfigPath } = environment;

if (tsconfigPath && config.source.aliasStrategy === 'prefer-tsconfig') {
await applyTsConfigPathsPlugin({
2 changes: 1 addition & 1 deletion packages/core/src/createContext.ts
Original file line number Diff line number Diff line change
@@ -155,7 +155,7 @@ export async function updateEnvironmentContext(
browserslist,
htmlPaths,
tsconfigPath,
normalizedConfig: config,
config,
};
}
}
2 changes: 1 addition & 1 deletion packages/core/src/plugins/asset.ts
Original file line number Diff line number Diff line change
@@ -75,7 +75,7 @@ export const pluginAsset = (): RsbuildPlugin => ({

setup(api) {
api.modifyBundlerChain((chain, { isProd, environment }) => {
const config = environment.normalizedConfig;
const { config } = environment;

const createAssetRule = (
assetType: 'image' | 'media' | 'font' | 'svg',
2 changes: 1 addition & 1 deletion packages/core/src/plugins/basic.ts
Original file line number Diff line number Diff line change
@@ -19,7 +19,7 @@ export const pluginBasic = (): RsbuildPlugin => ({
setup(api) {
api.modifyBundlerChain(
(chain, { env, isProd, target, bundler, environment, CHAIN_ID }) => {
const config = environment.normalizedConfig;
const { config } = environment;

chain.name(environment.name);

2 changes: 1 addition & 1 deletion packages/core/src/plugins/bundleAnalyzer.ts
Original file line number Diff line number Diff line change
@@ -42,7 +42,7 @@ export function pluginBundleAnalyzer(): RsbuildPlugin {
});

api.modifyBundlerChain(async (chain, { CHAIN_ID, environment }) => {
const config = environment.normalizedConfig;
const { config } = environment;

if (!isUseAnalyzer(config)) {
return;
2 changes: 1 addition & 1 deletion packages/core/src/plugins/cache.ts
Original file line number Diff line number Diff line change
@@ -109,7 +109,7 @@ export const pluginCache = (): RsbuildPlugin => ({
}

api.modifyBundlerChain(async (chain, { environment, env }) => {
const config = environment.normalizedConfig;
const { config } = environment;
const { buildCache } = config.performance;

if (buildCache === false) {
2 changes: 1 addition & 1 deletion packages/core/src/plugins/cleanOutput.ts
Original file line number Diff line number Diff line change
@@ -18,7 +18,7 @@ export const pluginCleanOutput = (): RsbuildPlugin => ({
setup(api) {
const clean = async (environment: EnvironmentContext) => {
const { rootPath } = api.context;
const { normalizedConfig: config, distPath } = environment;
const { config, distPath } = environment;

let { cleanDistPath } = config.output;

2 changes: 1 addition & 1 deletion packages/core/src/plugins/css.ts
Original file line number Diff line number Diff line change
@@ -327,7 +327,7 @@ export const pluginCss = (): RsbuildPlugin => ({
order: 'pre',
handler: async (chain, utils) => {
const rule = chain.module.rule(utils.CHAIN_ID.RULE.CSS);
const config = utils.environment.normalizedConfig;
const config = utils.environment.config;
rule.test(CSS_REGEX);
await applyCSSRule({
rule,
2 changes: 1 addition & 1 deletion packages/core/src/plugins/define.ts
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@ export const pluginDefine = (): RsbuildPlugin => ({

setup(api) {
api.modifyBundlerChain((chain, { CHAIN_ID, bundler, environment }) => {
const config = environment.normalizedConfig;
const { config } = environment;
const builtinVars: Define = {
'process.env.NODE_ENV': JSON.stringify(getNodeEnv()),
'process.env.ASSET_PREFIX': JSON.stringify(
2 changes: 1 addition & 1 deletion packages/core/src/plugins/entry.ts
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@ export const pluginEntry = (): RsbuildPlugin => ({

setup(api) {
api.modifyBundlerChain(async (chain, { environment, isServer }) => {
const { normalizedConfig: config, entry } = environment;
const { config, entry } = environment;
const { preEntry } = config.source;

const injectCoreJsEntry = config.output.polyfill === 'entry' && !isServer;
2 changes: 1 addition & 1 deletion packages/core/src/plugins/externals.ts
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@ export function pluginExternals(): RsbuildPlugin {
name: 'rsbuild:externals',
setup(api) {
api.modifyBundlerChain((chain, { environment }) => {
const { externals } = environment.normalizedConfig.output;
const { externals } = environment.config.output;
if (externals) {
chain.externals(externals);
}
6 changes: 3 additions & 3 deletions packages/core/src/plugins/html.ts
Original file line number Diff line number Diff line change
@@ -278,7 +278,7 @@ export const pluginHtml = (modifyTagsFn?: ModifyHTMLTagsFn): RsbuildPlugin => ({
setup(api) {
api.modifyBundlerChain(
async (chain, { HtmlPlugin, isProd, CHAIN_ID, environment }) => {
const config = environment.normalizedConfig;
const { config } = environment;

const htmlPaths = api.getHTMLPaths({ environment: environment.name });
if (Object.keys(htmlPaths).length === 0) {
@@ -340,7 +340,7 @@ export const pluginHtml = (modifyTagsFn?: ModifyHTMLTagsFn): RsbuildPlugin => ({
htmlInfo.templateContent = templateContent;
}

const tagConfig = getTagConfig(environment.normalizedConfig);
const tagConfig = getTagConfig(environment.config);
if (tagConfig) {
htmlInfo.tagConfig = tagConfig;
}
@@ -414,7 +414,7 @@ export const pluginHtml = (modifyTagsFn?: ModifyHTMLTagsFn): RsbuildPlugin => ({
// ensure `crossorigin` and `nonce` can be applied to all tags
order: 'post',
handler: ({ headTags, bodyTags }, { environment }) => {
const config = environment.normalizedConfig;
const { config } = environment;
const { crossorigin } = config.html;
const allTags = [...headTags, ...bodyTags];

2 changes: 1 addition & 1 deletion packages/core/src/plugins/inlineChunk.ts
Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@ export const pluginInlineChunk = (): RsbuildPlugin => ({
return;
}

const config = environment.normalizedConfig;
const { config } = environment;
const { InlineChunkHtmlPlugin } = await import(
'../rspack/InlineChunkHtmlPlugin'
);
2 changes: 1 addition & 1 deletion packages/core/src/plugins/lazyCompilation.ts
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@ export const pluginLazyCompilation = (): RsbuildPlugin => ({
return;
}

const config = environment.normalizedConfig;
const { config } = environment;

const options = config.dev?.lazyCompilation;
if (!options) {
2 changes: 1 addition & 1 deletion packages/core/src/plugins/manifest.ts
Original file line number Diff line number Diff line change
@@ -146,7 +146,7 @@ export const pluginManifest = (): RsbuildPlugin => ({
api.modifyBundlerChain(async (chain, { CHAIN_ID, environment }) => {
const {
output: { manifest },
} = environment.normalizedConfig;
} = environment.config;

if (manifest === false) {
return;
2 changes: 1 addition & 1 deletion packages/core/src/plugins/minimize.ts
Original file line number Diff line number Diff line change
@@ -108,7 +108,7 @@ export const pluginMinimize = (): RsbuildPlugin => ({
}

api.modifyBundlerChain(async (chain, { isProd, environment }) => {
const config = environment.normalizedConfig;
const { config } = environment;
const isMinimize = isProd && config.output.minify !== false;

if (!isMinimize) {
2 changes: 1 addition & 1 deletion packages/core/src/plugins/moduleFederation.ts
Original file line number Diff line number Diff line change
@@ -107,7 +107,7 @@ export function pluginModuleFederation(): RsbuildPlugin {

api.modifyBundlerChain(
async (chain, { CHAIN_ID, target, environment }) => {
const config = environment.normalizedConfig;
const { config } = environment;

if (!config.moduleFederation?.options || target !== 'web') {
return;
2 changes: 1 addition & 1 deletion packages/core/src/plugins/moment.ts
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@ export const pluginMoment = (): RsbuildPlugin => ({

setup(api) {
api.modifyBundlerChain(async (chain, { environment, bundler }) => {
const config = environment.normalizedConfig;
const { config } = environment;

if (config.performance.removeMomentLocale) {
// Moment.js includes a lots of locale data by default.
4 changes: 2 additions & 2 deletions packages/core/src/plugins/nonce.ts
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@ export const pluginNonce = (): RsbuildPlugin => ({
setup(api) {
api.onAfterCreateCompiler(({ compiler, environments }) => {
const nonces = Object.values(environments).map((environment) => {
const { nonce } = environment.normalizedConfig.security;
const { nonce } = environment.config.security;

return nonce;
});
@@ -41,7 +41,7 @@ export const pluginNonce = (): RsbuildPlugin => ({
// ensure `nonce` can be applied to all tags
order: 'post',
handler: ({ headTags, bodyTags }, { environment }) => {
const config = environment.normalizedConfig;
const { config } = environment;
const { nonce } = config.security;
const allTags = [...headTags, ...bodyTags];

2 changes: 1 addition & 1 deletion packages/core/src/plugins/output.ts
Original file line number Diff line number Diff line change
@@ -58,7 +58,7 @@ export const pluginOutput = (): RsbuildPlugin => ({
setup(api) {
api.modifyBundlerChain(
async (chain, { CHAIN_ID, target, isProd, isServer, environment }) => {
const { distPath, normalizedConfig: config } = environment;
const { distPath, config } = environment;

const publicPath = getPublicPath({
config,
2 changes: 1 addition & 1 deletion packages/core/src/plugins/performance.ts
Original file line number Diff line number Diff line change
@@ -41,7 +41,7 @@ export const pluginPerformance = (): RsbuildPlugin => ({
});

api.modifyBundlerChain((chain, { environment }) => {
const config = environment.normalizedConfig;
const { config } = environment;
const { profile } = config.performance;
if (!profile) {
return;
4 changes: 2 additions & 2 deletions packages/core/src/plugins/resolve.ts
Original file line number Diff line number Diff line change
@@ -88,7 +88,7 @@ export const pluginResolve = (): RsbuildPlugin => ({
api.modifyBundlerChain({
order: 'pre',
handler: (chain, { environment, CHAIN_ID }) => {
const config = environment.normalizedConfig;
const { config } = environment;

applyExtensions({ chain });

@@ -104,7 +104,7 @@ export const pluginResolve = (): RsbuildPlugin => ({
});

api.modifyRspackConfig(async (rspackConfig, { environment }) => {
const { tsconfigPath, normalizedConfig: config } = environment;
const { tsconfigPath, config } = environment;

if (tsconfigPath && config.source.aliasStrategy === 'prefer-tsconfig') {
rspackConfig.resolve ||= {};
4 changes: 2 additions & 2 deletions packages/core/src/plugins/resourceHints.ts
Original file line number Diff line number Diff line change
@@ -22,7 +22,7 @@ export const pluginResourceHints = (): RsbuildPlugin => ({

setup(api) {
api.modifyHTMLTags(({ headTags, bodyTags }, { environment }) => {
const config = environment.normalizedConfig;
const { config } = environment;
const { dnsPrefetch, preconnect } = config.performance;

if (dnsPrefetch) {
@@ -51,7 +51,7 @@ export const pluginResourceHints = (): RsbuildPlugin => ({
return;
}

const config = environment.normalizedConfig;
const { config } = environment;
const {
performance: { preload, prefetch },
} = config;
2 changes: 1 addition & 1 deletion packages/core/src/plugins/splitChunks.ts
Original file line number Diff line number Diff line change
@@ -246,7 +246,7 @@ export const pluginSplitChunks = (): RsbuildPlugin => ({
return;
}

const config = environment.normalizedConfig;
const { config } = environment;
const defaultConfig: Exclude<SplitChunks, false> = {
// Optimize both `initial` and `async` chunks
chunks: 'all',
2 changes: 1 addition & 1 deletion packages/core/src/plugins/sri.ts
Original file line number Diff line number Diff line change
@@ -25,7 +25,7 @@ export const pluginSri = (): RsbuildPlugin => ({
const placeholder = 'RSBUILD_INTEGRITY_PLACEHOLDER:';

const getAlgorithm = (environment: EnvironmentContext) => {
const config = environment.normalizedConfig;
const { config } = environment;
const { sri } = config.security;
const enable = sri.enable === 'auto' ? isProd() : sri.enable;

2 changes: 1 addition & 1 deletion packages/core/src/plugins/swc.ts
Original file line number Diff line number Diff line change
@@ -54,7 +54,7 @@ export const pluginSwc = (): RsbuildPlugin => ({
api.modifyBundlerChain({
order: 'pre',
handler: async (chain, { CHAIN_ID, target, environment }) => {
const { normalizedConfig: config, browserslist } = environment;
const { config, browserslist } = environment;

const rule = chain.module
.rule(CHAIN_ID.RULE.JS)
2 changes: 1 addition & 1 deletion packages/core/src/plugins/wasm.ts
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@ export const pluginWasm = (): RsbuildPlugin => ({

setup(api) {
api.modifyBundlerChain(async (chain, { CHAIN_ID, environment }) => {
const config = environment.normalizedConfig;
const { config } = environment;
const distPath = config.output.distPath.wasm;

chain.experiments({
24 changes: 12 additions & 12 deletions packages/core/tests/__snapshots__/environments.test.ts.snap
Original file line number Diff line number Diff line change
@@ -6,12 +6,7 @@ exports[`environment config > should normalize context correctly 1`] = `
"browserslist": [
"node >= 16",
],
"distPath": "<ROOT>/dist1/server",
"entry": {},
"htmlPaths": {},
"index": 0,
"name": "ssr",
"normalizedConfig": {
"config": {
"dev": {
"assetPrefix": "/",
"client": {
@@ -125,6 +120,11 @@ exports[`environment config > should normalize context correctly 1`] = `
},
},
},
"distPath": "<ROOT>/dist1/server",
"entry": {},
"htmlPaths": {},
"index": 0,
"name": "ssr",
"target": "node",
"tsconfigPath": undefined,
},
@@ -135,12 +135,7 @@ exports[`environment config > should normalize context correctly 1`] = `
"firefox >= 78",
"safari >= 14",
],
"distPath": "<ROOT>/dist1",
"entry": {},
"htmlPaths": {},
"index": 1,
"name": "web",
"normalizedConfig": {
"config": {
"dev": {
"assetPrefix": "/",
"client": {
@@ -254,6 +249,11 @@ exports[`environment config > should normalize context correctly 1`] = `
},
},
},
"distPath": "<ROOT>/dist1",
"entry": {},
"htmlPaths": {},
"index": 1,
"name": "web",
"target": "web",
"tsconfigPath": undefined,
},
2 changes: 1 addition & 1 deletion packages/core/tests/external.test.ts
Original file line number Diff line number Diff line change
@@ -21,7 +21,7 @@ describe('plugin-external', () => {

await modifyBundlerChainCb(chain, {
environment: {
normalizedConfig: {
config: {
output: {
externals: ['react', /@swc\/.*/],
},
2 changes: 1 addition & 1 deletion packages/plugin-assets-retry/src/index.ts
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@ export const pluginAssetsRetry = (
setup(api) {
api.modifyBundlerChain(
async (chain, { CHAIN_ID, HtmlPlugin, isProd, environment }) => {
const config = environment.normalizedConfig;
const { config } = environment;

const htmlPaths = api.getHTMLPaths({ environment: environment.name });
if (!options || Object.keys(htmlPaths).length === 0) {
2 changes: 1 addition & 1 deletion packages/plugin-babel/src/plugin.ts
Original file line number Diff line number Diff line change
@@ -105,7 +105,7 @@ export const pluginBabel = (

setup(api) {
const getBabelOptions = async (environment: EnvironmentContext) => {
const config = environment.normalizedConfig;
const { config } = environment;
const baseOptions = getDefaultBabelOptions(config, api.context);

const mergedOptions = applyUserBabelConfig(
2 changes: 1 addition & 1 deletion packages/plugin-css-minimizer/src/index.ts
Original file line number Diff line number Diff line change
@@ -67,7 +67,7 @@ export const pluginCssMinimizer = (

setup(api) {
api.modifyBundlerChain(async (chain, { CHAIN_ID, environment, isProd }) => {
const config = environment.normalizedConfig;
const { config } = environment;
const { minify } = config.output;

if (
2 changes: 1 addition & 1 deletion packages/plugin-less/src/index.ts
Original file line number Diff line number Diff line change
@@ -110,7 +110,7 @@ export const pluginLess = (

setup(api) {
api.modifyBundlerChain(async (chain, { CHAIN_ID, environment }) => {
const config = environment.normalizedConfig;
const { config } = environment;
const rule = chain.module
.rule(CHAIN_ID.RULE.LESS)
.test(/\.less$/)
2 changes: 1 addition & 1 deletion packages/plugin-react/src/react.ts
Original file line number Diff line number Diff line change
@@ -38,7 +38,7 @@ export const applyBasicReactSupport = (

api.modifyBundlerChain(
async (chain, { CHAIN_ID, environment, isDev, isProd, target }) => {
const config = environment.normalizedConfig;
const { config } = environment;
const usingHMR = !isProd && config.dev.hmr && target === 'web';
const reactOptions: Rspack.SwcLoaderTransformConfig['react'] = {
development: isDev,
2 changes: 1 addition & 1 deletion packages/plugin-react/src/splitChunks.ts
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@ export const applySplitChunksRule = (
},
): void => {
api.modifyBundlerChain((chain, { environment }) => {
const config = environment.normalizedConfig;
const { config } = environment;
if (config.performance.chunkSplit.strategy !== 'split-by-experience') {
return;
}
2 changes: 1 addition & 1 deletion packages/plugin-rem/src/index.ts
Original file line number Diff line number Diff line change
@@ -57,7 +57,7 @@ export const pluginRem = (options: PluginRemOptions = {}): RsbuildPlugin => ({
);

const entries = Object.keys(chain.entryPoints.entries() || {});
const config = environment.normalizedConfig;
const { config } = environment;
const distDir = config.output.distPath.js;

chain
4 changes: 2 additions & 2 deletions packages/plugin-solid/src/index.ts
Original file line number Diff line number Diff line change
@@ -19,7 +19,7 @@ export function pluginSolid(options: PluginSolidOptions = {}): RsbuildPlugin {
setup(api) {
api.modifyBundlerChain(
async (chain, { CHAIN_ID, environment, isProd, target }) => {
const rsbuildConfig = environment.normalizedConfig;
const environmentConfig = environment.config;

modifyBabelLoaderOptions({
chain,
@@ -32,7 +32,7 @@ export function pluginSolid(options: PluginSolidOptions = {}): RsbuildPlugin {
]);

const usingHMR =
!isProd && rsbuildConfig.dev.hmr && target === 'web';
!isProd && environmentConfig.dev.hmr && target === 'web';
if (usingHMR) {
babelOptions.plugins ??= [];
babelOptions.plugins.push([
2 changes: 1 addition & 1 deletion packages/plugin-stylus/src/index.ts
Original file line number Diff line number Diff line change
@@ -28,7 +28,7 @@ export const pluginStylus = (options?: PluginStylusOptions): RsbuildPlugin => ({

setup(api) {
api.modifyBundlerChain(async (chain, { CHAIN_ID, environment }) => {
const config = environment.normalizedConfig;
const { config } = environment;

const mergedOptions = reduceConfigs({
initial: {
6 changes: 3 additions & 3 deletions packages/plugin-svelte/src/index.ts
Original file line number Diff line number Diff line change
@@ -66,7 +66,7 @@ export function pluginSvelte(options: PluginSvelteOptions = {}): RsbuildPlugin {
'svelte-preprocess'
);

const rsbuildConfig = environment.normalizedConfig;
const environmentConfig = environment.config;

chain.resolve.alias.set(
'svelte',
@@ -97,8 +97,8 @@ export function pluginSvelte(options: PluginSvelteOptions = {}): RsbuildPlugin {
dev: isDev,
},
preprocess: sveltePreprocess(options.preprocessOptions),
emitCss: !rsbuildConfig.output.injectStyles,
hotReload: isDev && rsbuildConfig.dev.hmr,
emitCss: !environmentConfig.output.injectStyles,
hotReload: isDev && environmentConfig.dev.hmr,
},
options.svelteLoaderOptions ?? {},
);
2 changes: 1 addition & 1 deletion packages/plugin-svgr/src/index.ts
Original file line number Diff line number Diff line change
@@ -65,7 +65,7 @@ export const pluginSvgr = (options: PluginSvgrOptions = {}): RsbuildPlugin => ({

setup(api) {
api.modifyBundlerChain(async (chain, { CHAIN_ID, environment }) => {
const config = environment.normalizedConfig;
const { config } = environment;
const { dataUriLimit } = config.output;
const maxSize =
typeof dataUriLimit === 'number' ? dataUriLimit : dataUriLimit.svg;
2 changes: 1 addition & 1 deletion packages/plugin-vue-jsx/src/index.ts
Original file line number Diff line number Diff line change
@@ -19,7 +19,7 @@ export function pluginVueJsx(options: PluginVueJsxOptions = {}): RsbuildPlugin {
setup(api) {
api.modifyBundlerChain(
async (chain, { CHAIN_ID, environment, isProd, target }) => {
const config = environment.normalizedConfig;
const { config } = environment;

modifyBabelLoaderOptions({
chain,
2 changes: 1 addition & 1 deletion packages/plugin-vue/src/splitChunks.ts
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@ export const applySplitChunksRule = (
},
): void => {
api.modifyBundlerChain((chain, { environment }) => {
const config = environment.normalizedConfig;
const { config } = environment;
if (config.performance.chunkSplit.strategy !== 'split-by-experience') {
return;
}
2 changes: 1 addition & 1 deletion packages/plugin-vue2/src/splitChunks.ts
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@ export const applySplitChunksRule = (
},
): void => {
api.modifyBundlerChain((chain, { environment }) => {
const config = environment.normalizedConfig;
const { config } = environment;
if (config.performance.chunkSplit.strategy !== 'split-by-experience') {
return;
}
2 changes: 1 addition & 1 deletion packages/shared/src/types/hooks.ts
Original file line number Diff line number Diff line change
@@ -128,7 +128,7 @@ export type EnvironmentContext = {
distPath: string;
browserslist: string[];
tsconfigPath?: string;
normalizedConfig: NormalizedEnvironmentConfig;
config: NormalizedEnvironmentConfig;
};

export type ModifyChainUtils = {

0 comments on commit dffaa6a

Please sign in to comment.