rollup / plugins

šŸ£ The one-stop shop for official Rollup plugins
MIT License
3.62k stars 580 forks source link

[@rollup/plugin-typescript] Cannot resolve input filepath which is absolute path and begin with lower case drive letter on windows #1703

Open JohnLee1243 opened 5 months ago

JohnLee1243 commented 5 months ago

Expected Behavior

Build Successed.

Actual Behavior

d:/rollup-typescript-plugin-absolute-path/src/main.ts ā†’ dist...
[!] RollupError: ../../d:/rollup-typescript-plugin-absolute-path/src/main.ts (1:21): Expected ',', got ':' (Note that you need plugins to import files that are not JavaScript)
../../d:/rollup-typescript-plugin-absolute-path/src/main.ts (1:21)
1: export function foo(a: number) {
                        ^
2:   console.log(a);
3: }
RollupError: Expected ',', got ':'
    at Object.getRollupError (D:\rollup-typescript-plugin-absolute-path\node_modules\rollup\dist\shared\parseAst.js:282:41)
    at ParseError.initialise (D:\rollup-typescript-plugin-absolute-path\node_modules\rollup\dist\shared\rollup.js:12611:40)
    at convertNode (D:\rollup-typescript-plugin-absolute-path\node_modules\rollup\dist\shared\rollup.js:14356:10)
    at convertProgram (D:\rollup-typescript-plugin-absolute-path\node_modules\rollup\dist\shared\rollup.js:13673:12)
    at Module.setSource (D:\rollup-typescript-plugin-absolute-path\node_modules\rollup\dist\shared\rollup.js:15510:24)
    at async ModuleLoader.addModuleSource (D:\rollup-typescript-plugin-absolute-path\node_modules\rollup\dist\shared\rollup.js:19819:13)
  [cause] RollupError: Expected ',', got ':'
      at Object.getRollupError (D:\rollup-typescript-plugin-absolute-path\node_modules\rollup\dist\shared\parseAst.js:282:41)
      at ParseError.initialise (D:\rollup-typescript-plugin-absolute-path\node_modules\rollup\dist\shared\rollup.js:12611:40)
      at convertNode (D:\rollup-typescript-plugin-absolute-path\node_modules\rollup\dist\shared\rollup.js:14356:10)
      at convertProgram (D:\rollup-typescript-plugin-absolute-path\node_modules\rollup\dist\shared\rollup.js:13673:12)
      at Module.setSource (D:\rollup-typescript-plugin-absolute-path\node_modules\rollup\dist\shared\rollup.js:15510:24)
      at async ModuleLoader.addModuleSource (D:\rollup-typescript-plugin-absolute-path\node_modules\rollup\dist\shared\rollup.js:19819:13)

Additional Information

This problem occurs on the windows. I download the project to disk D:/ and decompress it. If the input is absolute path and starts with D:/. It will build successfully, but if the absolute path of input starts with 'd:/', error above happens. In my opinion, for drive letter both upper and lower case should be supported.