Skip to content
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

cleanVueFileName cannot work with rollupTypes #276

Closed
3 tasks done
tlserver opened this issue Oct 13, 2023 · 0 comments
Closed
3 tasks done

cleanVueFileName cannot work with rollupTypes #276

tlserver opened this issue Oct 13, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@tlserver
Copy link

Describe the bug

This example project build correctly now. However, an error occurs if cleanVueFileName: true, in vite.config.ts is uncommented.

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    vue(),

    DTS({
      // cleanVueFileName: true,
      rollupTypes: true,
    }),
  ],
  build: {
// ...
    lib: {
      entry: [
        resolve(__dirname, 'src/App.vue'),
        resolve(__dirname, 'src/components/Entry1.vue'),
        resolve(__dirname, 'src/components/Entry2.vue'),
      ],
      formats: ['es'],
    },
// ...
});

Error message:

[vite:dts] Internal Error: getResolvedModule() could not resolve module name "./components/Entry1.vue"
/home/projects/vitejs-vite-izfn7d/dist/Entry1.vue.d.ts:1:1

You have encountered a software defect. Please consider reporting the issue to the maintainers of this application.
✓ built in 3.02s
error during build:
Error: Internal Error: getResolvedModule() could not resolve module name "./components/Entry1.vue"
/home/projects/vitejs-vite-izfn7d/dist/Entry1.vue.d.ts:1:1

You have encountered a software defect. Please consider reporting the issue to the maintainers of this application.
    at new InternalError (/home/projects/vitejs-vite-izfn7d/node_modules/@rushstack/node-core-library/lib/InternalError.js:24:9)
    at ExportAnalyzer._fetchSpecifierAstModule (/home/projects/vitejs-vite-izfn7d/node_modules/@microsoft/api-extractor/lib/analyzer/ExportAnalyzer.js:676:19)
    at ExportAnalyzer.fetchAstModuleFromSourceFile (/home/projects/vitejs-vite-izfn7d/node_modules/@microsoft/api-extractor/lib/analyzer/ExportAnalyzer.js:112:65)
    at AstSymbolTable.fetchAstModuleFromWorkingPackage (/home/projects/vitejs-vite-izfn7d/node_modules/@microsoft/api-extractor/lib/analyzer/AstSymbolTable.js:83:37)
    at Collector.analyze (/home/projects/vitejs-vite-izfn7d/node_modules/@microsoft/api-extractor/lib/collector/Collector.js:155:51)
    at Extractor.invoke (/home/projects/vitejs-vite-izfn7d/node_modules/@microsoft/api-extractor/lib/api/Extractor.js:143:19)
    at rollupDeclarationFiles (/home/projects/vitejs-vite-izfn7d/node_modules/vite-plugin-dts/dist/index.mjs:266:53)
    at Object.writeBundle (/home/projects/vitejs-vite-izfn7d/node_modules/vite-plugin-dts/dist/index.mjs:891:15)
    at async PluginDriver.hookParallel (/home/projects/vitejs-vite-izfn7d/node_modules/rollup/dist/es/shared/node-entry.js:25497:9)

Entry1.vue.d.ts :

export * from './components/Entry1.vue'

Main problem: the dist folder do not have ./components/Entry1.vue file. It should be in src folder.

Reproduction

https://stackblitz.com/edit/qmhc-vite-plugin-dts-276?file=vite.config.ts

Steps to reproduce

run npm install
run vite build
uncomment cleanVueFileName: true, in vite.config.ts
run vite build

System Info

System:
    OS: Linux 5.0 undefined
    CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 0 Bytes / 0 Bytes
    Shell: 1.0 - /bin/jsh
  Binaries:
    Node: 18.18.0 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 9.4.2 - /usr/local/bin/npm
    pnpm: 8.6.12 - /usr/local/bin/pnpm
  npmPackages:
    @vitejs/plugin-vue: ^4.4.0 => 4.4.0 
    vite: 4.3.8 => 4.3.8 
    vite-plugin-dts: ^3.6.0 => 3.6.0

Validations

@qmhc qmhc added the bug Something isn't working label Oct 20, 2023
@qmhc qmhc closed this as completed in 261f7bc Oct 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants