Skip to content

Commit a07d661

Browse files
committed
minify and autoDetectExternal (true now)
1 parent 2c56607 commit a07d661

File tree

3 files changed

+28
-14
lines changed

3 files changed

+28
-14
lines changed

packages/cli-v3/src/build/bundle.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,10 @@ async function createBuildOptions(
180180
options.resolvedConfig.build?.keepNames ??
181181
options.resolvedConfig.build?.experimental_keepNames ??
182182
true;
183-
const minify = options.resolvedConfig.build?.experimental_minify ?? false;
183+
const minify =
184+
options.resolvedConfig.build?.minify ??
185+
options.resolvedConfig.build?.experimental_minify ??
186+
false;
184187

185188
const $buildPlugins = await buildPlugins(options.target, options.resolvedConfig);
186189

packages/cli-v3/src/build/externals.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,11 +159,16 @@ function createExternalsCollector(
159159
isExternalCache.clear();
160160
});
161161

162+
const autoDetectExternal =
163+
resolvedConfig.build?.autoDetectExternal ??
164+
resolvedConfig.build?.experimental_autoDetectExternal ??
165+
true;
166+
162167
build.onEnd(async () => {
163168
logger.debug("[externals][onEnd] Collected externals", {
164169
externals,
165170
maybeExternals,
166-
autoDetectExternal: !!resolvedConfig.build?.experimental_autoDetectExternal,
171+
autoDetectExternal,
167172
packageJsonCache: packageJsonCache.size,
168173
isExternalCache: isExternalCache.size,
169174
});
@@ -265,7 +270,7 @@ function createExternalsCollector(
265270
});
266271
});
267272

268-
if (resolvedConfig.build?.experimental_autoDetectExternal) {
273+
if (autoDetectExternal) {
269274
build.onResolve(
270275
{ filter: /.*/, namespace: "file" },
271276
async (args: esbuild.OnResolveArgs): Promise<esbuild.OnResolveResult | undefined> => {

packages/core/src/v3/config.ts

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -171,23 +171,24 @@ export type TriggerConfig = {
171171
external?: string[];
172172

173173
/**
174-
* **WARNING: This is an experimental feature and might be removed in a future version.**
174+
* This still works but use `autoDetectExternal` instead.
175175
*
176+
* @deprecated (use autoDetectExternal instead)
177+
*/
178+
experimental_autoDetectExternal?: boolean;
179+
180+
/**
176181
* Automatically detect dependencies that shouldn't be bundled and mark them as external. For example, native modules.
177182
*
178-
* Turning this on will not affect dependencies that were manually added to the `external` array.
183+
* Turn this off if you are having issues and want to manually specify all `external` dependencies.
179184
*
180-
* @default false
181-
*
182-
* @deprecated (experimental)
185+
* @default true
183186
*/
184-
experimental_autoDetectExternal?: boolean;
187+
autoDetectExternal?: boolean;
185188

186189
/**
187190
* This still works but use `keepNames` instead.
188191
*
189-
* @default true
190-
*
191192
* @deprecated (use keepNames instead)
192193
*/
193194
experimental_keepNames?: boolean;
@@ -201,6 +202,13 @@ export type TriggerConfig = {
201202
*/
202203
keepNames?: boolean;
203204

205+
/**
206+
* This still works but use `minify` instead.
207+
*
208+
* @deprecated (use minify instead)
209+
*/
210+
experimental_minify?: boolean;
211+
204212
/**
205213
* **WARNING: This is an experimental feature and might be removed in a future version.**
206214
*
@@ -211,10 +219,8 @@ export type TriggerConfig = {
211219
* @link https://esbuild.github.io/api/#minify
212220
*
213221
* @default false
214-
*
215-
* @deprecated (experimental)
216222
*/
217-
experimental_minify?: boolean;
223+
minify?: boolean;
218224

219225
jsx?: {
220226
/**

0 commit comments

Comments
 (0)