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

build: emit .d.ts files during yarn dev #4413

Merged
merged 2 commits into from
Jul 28, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 15 additions & 5 deletions packages/vite/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ const sharedNodeOptions = {
tryCatchDeoptimization: false
},
output: {
dir: path.resolve(__dirname, 'dist/node'),
entryFileNames: `[name].js`,
chunkFileNames: 'chunks/dep-[hash].js',
dir: path.resolve(__dirname, 'dist'),
entryFileNames: `node/[name].js`,
chunkFileNames: 'node/chunks/dep-[hash].js',
exports: 'named',
format: 'cjs',
externalLiveBindings: false,
Expand Down Expand Up @@ -125,8 +125,18 @@ const createNodeConfig = (isProduction) => {
nodeResolve({ preferBuiltins: true }),
typescript({
target: 'es2019',
include: ['src/**/*.ts'],
esModuleInterop: true
include: ['src/**/*.ts', 'types/**'],
exclude: ['src/**/__tests__/**'],
esModuleInterop: true,
// in production we use api-extractor for dts generation
// in development we need to rely on the rollup ts plugin
...(isProduction
? {}
: {
tsconfig: 'tsconfig.base.json',
declaration: true,
declarationDir: path.resolve(__dirname, 'dist/')
})
}),
// Some deps have try...catch require of optional deps, but rollup will
// generate code that force require them upfront for side effects.
Expand Down