wessberg / rollup-plugin-ts

A TypeScript Rollup plugin that bundles declarations, respects Browserslists, and enables seamless integration with transpilers such as babel and swc
MIT License
496 stars 32 forks source link

Yarn PNP @babel/plugin-syntax-dynamic-import warning #185

Closed SagnikPradhan closed 1 year ago

SagnikPradhan commented 2 years ago

Question

Using yarn PNP (loose mode) along babel + typescript, I get this warning. Upon further looking into the codebase, I see @babel/plugin-syntax-dynamic-import is explicitly required, but is not in mentioned in the peer dependencies. Shouldn't it be included too?

(node:105076) [MODULE_NOT_FOUND] Error: rollup-plugin-ts tried to access @babel/plugin-syntax-dynamic-import, but it isn't declared in its dependencies; this makes the require call ambiguous and unsound.
    at makeError (D:\Projects\absence\.pnp.cjs:17124:34)
    at resolveToUnqualified (D:\Projects\absence\.pnp.cjs:18038:21)
    at resolveRequest (D:\Projects\absence\.pnp.cjs:18129:31)
    at Object.resolveRequest (D:\Projects\absence\.pnp.cjs:18192:26)
    at Function.require$$0.Module._resolveFilename (D:\Projects\absence\.pnp.cjs:17352:34)
    at resolve (node:internal/modules/cjs/helpers:108:19)
    at getForcedBabelOptions (D:\Projects\absence\.yarn\__virtual__\rollup-plugin-ts-virtual-d3ddc4ca44\4\C:\Users\Sagnik Pradhan\AppData\Local\Yarn\Berry\cache\rollup-plugin-ts-npm-3.0.2-62f6d8bffb-9.zip\node_modules\rollup-plugin-ts\src\transpiler\babel.ts:55:4)
    at Object.options (D:\Projects\absence\.yarn\__virtual__\rollup-plugin-ts-virtual-d3ddc4ca44\4\C:\Users\Sagnik Pradhan\AppData\Local\Yarn\Berry\cache\rollup-plugin-ts-npm-3.0.2-62f6d8bffb-9.zip\node_modules\rollup-plugin-ts\src\plugin\typescript-plugin.ts:270:21)
    at C:\Users\Sagnik Pradhan\AppData\Local\Yarn\Berry\cache\rollup-npm-2.75.7-3918160ee7-9.zip\node_modules\rollup\dist\shared\rollup.js:23716:22
    at getInputOptions (C:\Users\Sagnik Pradhan\AppData\Local\Yarn\Berry\cache\rollup-npm-2.75.7-3918160ee7-9.zip\node_modules\rollup\dist\shared\rollup.js:23709:61)

It seems like, under typical scenarios, it's falling back to other dependencies to provide it.