We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Source map files are not being generated in the following scenarios:
It can be reproduced with below code structure
// src/index.ts <- entry export * from './foo' // src/foo/index.ts export { bar } from './bar' // src/foo/bar.ts export const bar = 'bar'
After building, I expected source map files generated for the .d.ts files as shown below
.d.ts
dist |_ foo | |_index.d.ts | |_index.d.ts.map | |_bar.d.ts | |_bar.d.ts.map |_index.d.ts |_index.d.ts.map |_ ...
but none of these 3 .d.ts files doesn't generate their corresponding source map files.
Here is the config that I used to reproduce, which is the one in reproduction link.
// vite.config.ts import { defineConfig } from 'vite'; import react from '@vitejs/plugin-react'; import dts from 'vite-plugin-dts'; import { resolve } from 'node:path'; // https://vitejs.dev/config/ export default defineConfig({ plugins: [ react(), dts({ include: ['src'], insertTypesEntry: true, outDir: ['dist'], tsconfigPath: resolve(__dirname, 'tsconfig.json'), compilerOptions: { declaration: true, declarationMap: true, }, }), ], build: { sourcemap: true, lib: { entry: resolve('src', 'index.ts'), name: 'my-lib', formats: ['es', 'cjs'], fileName: (format) => `index.${format === 'cjs' ? 'cjs' : 'es.js'}`, }, rollupOptions: { external: ['react', 'react-dom'], output: { globals: { react: 'React', 'react-dom': 'ReactDOM', }, }, }, }, });
https://stackblitz.com/edit/vitejs-vite-z9j9ux?file=package.json
vite build
dist
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: 16.20.0 - /usr/local/bin/node Yarn: 1.22.19 - /usr/local/bin/yarn npm: 9.4.2 - /usr/local/bin/npm pnpm: 8.6.10 - /usr/local/bin/pnpm npmPackages: @vitejs/plugin-react: ^4.0.4 => 4.0.4 vite: ^4.4.8 => 4.4.8 vite-plugin-dts: ^3.5.1 => 3.5.1
The text was updated successfully, but these errors were encountered:
I checked that it works till @3.3.1 and since @3.4.0 it hasn't generated declarationMap files. it works on @3.3.1 => https://stackblitz.com/edit/vitejs-vite-qnchol?file=package.json
@3.3.1
@3.4.0
Sorry, something went wrong.
Same issue. it do not work even with 3.3.1 version
Successfully merging a pull request may close this issue.
Describe the bug
Source map files are not being generated in the following scenarios:
It can be reproduced with below code structure
After building, I expected source map files generated for the
.d.ts
files as shown belowbut none of these 3
.d.ts
files doesn't generate their corresponding source map files.Here is the config that I used to reproduce, which is the one in reproduction link.
Reproduction
https://stackblitz.com/edit/vitejs-vite-z9j9ux?file=package.json
Steps to reproduce
vite build
on terminaldist
directorySystem Info
Validations
The text was updated successfully, but these errors were encountered: