Skip to content

Commit

Permalink
build: emit .d.ts files during yarn dev (#4413)
Browse files Browse the repository at this point in the history
  • Loading branch information
sodatea committed Jul 28, 2021
1 parent 832d7f3 commit ecbc869
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions packages/vite/rollup.config.js
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

0 comments on commit ecbc869

Please sign in to comment.