Skip to content

fix: don't skip resolving files imported by other plugins #365

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 24, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ const typescript: PluginImpl<RPT2Options> = (options) =>
let service: tsTypes.LanguageService;
let noErrors = true;
const declarations: { [name: string]: { type: tsTypes.OutputFile; map?: tsTypes.OutputFile } } = {};
const allImportedFiles = new Set<string>();

let _cache: TsCache;
const cache = (): TsCache =>
Expand Down Expand Up @@ -103,8 +102,6 @@ const typescript: PluginImpl<RPT2Options> = (options) =>

if (generateRound === 0)
{
parsedConfig.fileNames.map(allImportedFiles.add, allImportedFiles);

context.info(`typescript version: ${tsModule.version}`);
context.info(`tslib version: ${tslibVersion}`);
if (this.meta)
Expand Down Expand Up @@ -156,10 +153,6 @@ const typescript: PluginImpl<RPT2Options> = (options) =>

importer = normalize(importer);

// avoiding trying to resolve ids for things imported from files unrelated to this plugin
if (!allImportedFiles.has(importer))
return;

// TODO: use module resolution cache
const result = tsModule.nodeModuleNameResolver(importee, importer, parsedConfig.options, tsModule.sys);
let resolved = result.resolvedModule?.resolvedFileName;
Expand Down Expand Up @@ -197,8 +190,6 @@ const typescript: PluginImpl<RPT2Options> = (options) =>
if (!filter(id))
return undefined;

allImportedFiles.add(normalize(id));

const contextWrapper = new RollupContext(pluginOptions.verbosity, pluginOptions.abortOnError, this, "rpt2: ");

const snapshot = servicesHost.setSnapshot(id, code);
Expand Down Expand Up @@ -229,9 +220,6 @@ const typescript: PluginImpl<RPT2Options> = (options) =>
if (!result)
return undefined;

if (result.references)
result.references.map(normalize).map(allImportedFiles.add, allImportedFiles);

if (watchMode && this.addWatchFile && result.references)
{
if (tsConfigPath)
Expand Down