@@ -160,7 +160,6 @@ async function runDtsBundler(entrypoint, output) {
160
160
* @param {BundlerTaskOptions } [taskOptions]
161
161
*
162
162
* @typedef BundlerTaskOptions
163
- * @property {string[] } [external]
164
163
* @property {boolean } [exportIsTsObject]
165
164
* @property {boolean } [treeShaking]
166
165
* @property {esbuild.WatchMode } [watchMode]
@@ -179,32 +178,10 @@ function createBundler(entrypoint, outfile, taskOptions = {}) {
179
178
sourcemap : "linked" ,
180
179
sourcesContent : false ,
181
180
treeShaking : taskOptions . treeShaking ,
182
- external : [
183
- ...( taskOptions . external ?? [ ] ) ,
184
- "source-map-support" ,
185
- ] ,
181
+ packages : "external" ,
186
182
logLevel : "warning" ,
187
183
// legalComments: "none", // If we add copyright headers to the source files, uncomment.
188
184
plugins : [
189
- {
190
- name : "no-node-modules" ,
191
- setup : ( build ) => {
192
- build . onLoad ( { filter : / [ \\ / ] n o d e _ m o d u l e s [ \\ / ] / } , ( ) => {
193
- // Ideally, we'd use "--external:./node_modules/*" here, but that doesn't work; we
194
- // will instead end up with paths to node_modules rather than the package names.
195
- // Instead, we'll return a load error when we see that we're trying to bundle from
196
- // node_modules, then explicitly declare which external dependencies we rely on, which
197
- // ensures that the correct module specifier is kept in the output (the non-wildcard
198
- // form works properly). It also helps us keep tabs on what external dependencies we
199
- // may be importing, which is handy.
200
- //
201
- // See: https://github.com/evanw/esbuild/issues/1958
202
- return {
203
- errors : [ { text : 'Attempted to bundle from node_modules; ensure "external" is set correctly.' } ]
204
- } ;
205
- } ) ;
206
- }
207
- } ,
208
185
{
209
186
name : "fix-require" ,
210
187
setup : ( build ) => {
@@ -448,14 +425,6 @@ const { main: tests, watch: watchTests } = entrypointBuildTask({
448
425
bundlerOptions : {
449
426
// Ensure we never drop any dead code, which might be helpful while debugging.
450
427
treeShaking : false ,
451
- // These are directly imported via import statements and should not be bundled.
452
- external : [
453
- "chai" ,
454
- "del" ,
455
- "diff" ,
456
- "mocha" ,
457
- "ms" ,
458
- ] ,
459
428
watchMode : {
460
429
onRebuild ( ) {
461
430
watchTestsEmitter . emit ( "rebuild" ) ;
0 commit comments