Expected Behavior
On plugin-typescript 12.1.2 and below, it was possible to use a plugin with resolveId and declare module "xyz" { ... } to load modules outside the standard resolution path (for instance, loading generated sources from elsewhere).
For instance, with the following in your rollup.config.js.
plugins: [
typescript(),
{
name: "custom",
async resolveId(source) {
if (source === "test-module") return path.resolve("generated/test-module.js")
}
}
]
and the following declaration file:
declare module "test-module" {
export const sayHello: () => void;
}
Then it was possible to import "test-module" from a Typescript file.
Actual Behavior
This no longer works under the recent 12.1.3 release (I assume this is introduced by #1653), failing with the following:
(!) [plugin typescript] src/index.ts (1:26): @rollup/plugin-typescript TS2307: Cannot find module 'test-module' or its corresponding type declarations.
rollup-demo/src/index.ts:1:26
1 import { sayHello } from "test-module";
~~~~~~~~~~~~~
Additional Information
It's possible I'm doing something utterly unspeakable and unsupported! I wasn't sure if this was an accidental breaking change or just Hyrum's law in action, so felt worth reporting.
Expected Behavior
On
plugin-typescript12.1.2 and below, it was possible to use a plugin withresolveIdanddeclare module "xyz" { ... }to load modules outside the standard resolution path (for instance, loading generated sources from elsewhere).For instance, with the following in your
rollup.config.js.and the following declaration file:
Then it was possible to import
"test-module"from a Typescript file.Actual Behavior
This no longer works under the recent 12.1.3 release (I assume this is introduced by #1653), failing with the following:
Additional Information
It's possible I'm doing something utterly unspeakable and unsupported! I wasn't sure if this was an accidental breaking change or just Hyrum's law in action, so felt worth reporting.