You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: preemptively filter type-only files to workaround Rollup bug
- basically, right now, the addition of `this.load` on all `references` is causing Rollup to error out on JSON files
- specifically, this is impacting `configPlugin` usage (i.e. `rollup.config.ts`), where previously one didn't need `@rollup/plugin-json`, but now it is erroring out without it
- I tracked this down to be because of `this.load` specifically
- to avoid this and similar such issues, we can preemptively `filter` out files before calling `this.resolve` / `this.load`, which should end up `exclude`ing JSON files and any other non-rpt2 files
- this should also make it a bit more efficient to skip some recursion
- and non-rpt2 files shouldn't include any type-only files
- confirmed that this change fixes the error
- and that the type-only tests still pass
// Rollup can't see these otherwise, because they are "emit-less" and produce no JS
275
275
if(result.references&&supportsThisLoad){
276
276
for(constrefofresult.references){
277
+
// pre-emptively filter out some files (for efficiency, as well as to workaround a Rollup bug: https://github.com/ezolenko/rollup-plugin-typescript2/issues/426#issuecomment-1264812897)
277
278
if(ref.endsWith(".d.ts"))
278
279
continue;
280
+
if(!filter(ref))
281
+
continue;
279
282
280
283
constmodule=awaitthis.resolve(ref,id);
281
284
if(!module||transformedFiles.has(module.id))// check for circular references (per https://rollupjs.org/guide/en/#thisload)
0 commit comments