@@ -2,7 +2,7 @@ import path from 'path';
2
2
import { createRequire } from 'node:module' ;
3
3
import { testSuite , expect } from 'manten' ;
4
4
import { createFixture } from 'fs-fixture' ;
5
- import { execa } from 'execa' ;
5
+ import { execa , ExecaError } from 'execa' ;
6
6
import { tsconfigJson } from '../utils.js' ;
7
7
8
8
const webpackCli = path . resolve ( 'node_modules/webpack-cli/bin/cli.js' ) ;
@@ -263,6 +263,78 @@ export default testSuite(({ describe }) => {
263
263
const code2 = await fixture . readFile ( 'dist/index2.js' , 'utf8' ) ;
264
264
expect ( code2 ) . toMatch ( '__publicField(this, "foo", 100);' ) ;
265
265
} ) ;
266
+
267
+ test ( 'ignores tsconfig.json in third party dependencies' , async ( ) => {
268
+ await using fixture = await createFixture ( {
269
+ // Fake external dependency
270
+ node_modules : {
271
+ 'fake-lib' : {
272
+ 'index.js' : 'export function testFn() { return "Hi!" }' ,
273
+ 'package.json' : JSON . stringify ( {
274
+ name : 'fake-lib' ,
275
+ exports : {
276
+ '.' : './index.js' ,
277
+ } ,
278
+ } ) ,
279
+ 'tsconfig.json' : tsconfigJson ( {
280
+ extends : 'something-imaginary' ,
281
+ } ) ,
282
+ } ,
283
+ } ,
284
+ // Our project
285
+ src : {
286
+ 'index.ts' : `
287
+ import { testFn } from "fake-lib";
288
+
289
+ export default testFn;` ,
290
+ } ,
291
+ 'webpack.config.js' : `
292
+ module.exports = {
293
+ mode: 'production',
294
+
295
+ optimization: {
296
+ minimize: false,
297
+ },
298
+
299
+ resolveLoader: {
300
+ alias: {
301
+ 'esbuild-loader': ${ JSON . stringify ( esbuildLoader ) } ,
302
+ },
303
+ },
304
+
305
+ module: {
306
+ rules: [
307
+ {
308
+ test: /.[tj]sx?$/,
309
+ loader: 'esbuild-loader',
310
+ options: {
311
+ target: 'es2015',
312
+ }
313
+ }
314
+ ],
315
+ },
316
+
317
+ entry: {
318
+ index: './src/index.ts',
319
+ },
320
+ };
321
+ ` ,
322
+ } ) ;
323
+
324
+ let result ;
325
+
326
+ try {
327
+ result = await execa ( webpackCli , {
328
+ cwd : fixture . path ,
329
+ } ) ;
330
+ } catch ( error ) {
331
+ result = error as ExecaError ;
332
+ }
333
+ const { exitCode, stderr } = result ;
334
+
335
+ expect ( stderr ) . not . toMatch ( "File 'something-imaginary' not found." ) ;
336
+ expect ( exitCode ) . toEqual ( 0 ) ;
337
+ } ) ;
266
338
} ) ;
267
339
268
340
describe ( 'plugin' , ( { test } ) => {
0 commit comments