From 003b028acf7f6f903d3e569bf2b000670fe0be58 Mon Sep 17 00:00:00 2001 From: Anton Gilgur Date: Wed, 17 Aug 2022 16:43:06 -0400 Subject: [PATCH] revert: back to using `vue.d.ts` instead of `.d.ts` for Vue declarations This reverts commit e145d0baebbbef1eec691b99d1ce0dce1e49f38c. - Per discussion on the original issue and reverted PR, it seems that the request to use `.d.ts` instead of `.vue.d.ts` was made in error - `.d.ts` seems to only be necessary if Vue users were importing `.vue` SFCs without extensions ("extensionless") - i.e. `import MyComponent from "./MyComponent"` instead of `import MyComponent from "./MyComponent.vue"` - and "extensionless" imports are no longer supported by the Vue team (but used to be) - requiring extensionless imports also breaks imports when extensions _are_ used - so these are not necessarily compatible with each other, but the Vue team support strongly suggests that `.vue.d.ts` would be the proper way forward --- src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index 9c5394d5..d732264e 100644 --- a/src/index.ts +++ b/src/index.ts @@ -345,7 +345,7 @@ const typescript: PluginImpl = (options) => let fileName = entry.name; if (fileName.includes("?")) // HACK for rollup-plugin-vue, it creates virtual modules in form 'file.vue?rollup-plugin-vue=script.ts' - fileName = fileName.split(".vue?", 1) + extension; + fileName = fileName.split("?", 1) + extension; // If 'useTsconfigDeclarationDir' is in plugin options, directly write to 'declarationDir'. // This may not be under Rollup's output directory, and thus can't be emitted as an asset.