Building multiple projects with same top-level configs (Rollup, `tsconfig`) results in declarations for *all* projects output for each project
See original GitHub issueWhat happens and why it is wrong
I’m building 2 projects with one rollup.config file, and the result is this:
As can be seen, I get the .d.ts
files for both projects in both dist
folders.
Environment
OSX.
Versions
- typescript: 2.8.1
- rollup: 0.57.1
- rollup-plugin-typescript2: 0.12.0
rollup.config.js
It’s auto-generated, so I can’t really paste it.
tsconfig.json
{
"compilerOptions": {
"strict": true,
"module": "esnext",
"target": "es2016",
"declaration": true
},
"exclude": ["node_modules", "**/node_modules/*"]
}
plugin output with verbosity 3
log
/Users/alxandr/hub/yolodev-aspnet-utils/packages/before-exit/src/before-exit.ts → packages/before-exit/dist/before-exit.js, packages/before-exit/dist/before-exit.mjs...
rpt2: typescript version: 2.8.1
rpt2: rollup-plugin-typescript2 version: 0.12.0
rpt2: plugin options:
{
"verbosity": 3,
"cacheRoot": "/Users/alxandr/hub/yolodev-aspnet-utils/packages/before-exit/.rpt2_cache",
"exclude": [
"*.d.ts",
"**/*.d.ts",
"/Users/alxandr/hub/yolodev-aspnet-utils/packages/workdir-pid/*"
],
"check": true,
"clean": false,
"include": [
"*.ts+(|x)",
"**/*.ts+(|x)"
],
"abortOnError": true,
"rollupCommonJSResolveHack": false,
"typescript": "version 2.8.1",
"useTsconfigDeclarationDir": false,
"tsconfigOverride": {},
"tsconfigDefaults": {}
}
rpt2: rollup config:
{
"external": [
"",
"assert",
"buffer",
"child_process",
"cluster",
"console",
"constants",
"crypto",
"dgram",
"dns",
"domain",
"events",
"fs",
"http",
"https",
"module",
"net",
"os",
"path",
"punycode",
"querystring",
"readline",
"repl",
"stream",
"string_decoder",
"sys",
"timers",
"tls",
"tty",
"url",
"util",
"vm",
"zlib",
"v8",
"process",
"async_hooks",
"http2",
"perf_hooks"
],
"input": "/Users/alxandr/hub/yolodev-aspnet-utils/packages/before-exit/src/before-exit.ts",
"perf": false,
"plugins": [
{
"name": "auto-external"
},
{
"name": "rpt2"
}
],
"entry": "/Users/alxandr/hub/yolodev-aspnet-utils/packages/before-exit/src/before-exit.ts"
}
rpt2: built-in options overrides: {
"noEmitHelpers": false,
"importHelpers": true,
"noResolve": false,
"noEmit": false,
"outDir": "/Users/alxandr/hub/yolodev-aspnet-utils",
"moduleResolution": 2,
"declarationDir": "/Users/alxandr/hub/yolodev-aspnet-utils"
}
rpt2: parsed tsconfig: {
"options": {
"module": 6,
"strict": true,
"target": 3,
"declaration": true,
"noEmitHelpers": false,
"importHelpers": true,
"noResolve": false,
"noEmit": false,
"outDir": "/Users/alxandr/hub/yolodev-aspnet-utils",
"moduleResolution": 2,
"declarationDir": "/Users/alxandr/hub/yolodev-aspnet-utils",
"configFilePath": "/Users/alxandr/hub/yolodev-aspnet-utils/tsconfig.json"
},
"fileNames": [
"/Users/alxandr/hub/yolodev-aspnet-utils/packages/before-exit/dist/before-exit/src/before-exit.d.ts",
"/Users/alxandr/hub/yolodev-aspnet-utils/packages/before-exit/dist/workdir-pid/src/workdir-pid.d.ts",
"/Users/alxandr/hub/yolodev-aspnet-utils/packages/before-exit/src/before-exit.ts",
"/Users/alxandr/hub/yolodev-aspnet-utils/packages/workdir-pid/dist/before-exit/src/before-exit.d.ts",
"/Users/alxandr/hub/yolodev-aspnet-utils/packages/workdir-pid/dist/workdir-pid/src/workdir-pid.d.ts",
"/Users/alxandr/hub/yolodev-aspnet-utils/packages/workdir-pid/src/workdir-pid.ts"
],
"typeAcquisition": {
"enable": false,
"include": [],
"exclude": []
},
"raw": {
"compilerOptions": {
"module": "esnext",
"strict": true,
"target": "es2016",
"declaration": true
},
"exclude": [
"node_modules",
"**/node_modules/*"
]
},
"errors": [],
"wildcardDirectories": {
"/users/alxandr/hub/yolodev-aspnet-utils": 1
},
"compileOnSave": false,
"configFileSpecs": {
"includeSpecs": [
"**/*"
],
"excludeSpecs": [
"node_modules",
"**/node_modules/*"
],
"validatedIncludeSpecs": [
"**/*"
],
"validatedExcludeSpecs": [
"node_modules",
"**/node_modules/*"
],
"wildcardDirectories": {
"/users/alxandr/hub/yolodev-aspnet-utils": 1
}
}
}
rpt2: included:
'[
"*.ts+(|x)",
"**/*.ts+(|x)"
]'
rpt2: excluded:
'[
"*.d.ts",
"**/*.d.ts",
"/Users/alxandr/hub/yolodev-aspnet-utils/packages/workdir-pid/*"
]'
rpt2: Ambient types:
rpt2: /Users/alxandr/hub/yolodev-aspnet-utils/packages/before-exit/dist/before-exit/src/before-exit.d.ts
rpt2: /Users/alxandr/hub/yolodev-aspnet-utils/packages/before-exit/dist/workdir-pid/src/workdir-pid.d.ts
rpt2: /Users/alxandr/hub/yolodev-aspnet-utils/packages/workdir-pid/dist/before-exit/src/before-exit.d.ts
rpt2: /Users/alxandr/hub/yolodev-aspnet-utils/packages/workdir-pid/dist/workdir-pid/src/workdir-pid.d.ts
rpt2: /Users/alxandr/hub/yolodev-aspnet-utils/node_modules/@types/acorn/index.d.ts
rpt2: /Users/alxandr/hub/yolodev-aspnet-utils/node_modules/@types/estree/index.d.ts
rpt2: /Users/alxandr/hub/yolodev-aspnet-utils/node_modules/@types/node/index.d.ts
rpt2: ambient types changed, redoing all semantic diagnostics
rpt2: transpiling '/Users/alxandr/hub/yolodev-aspnet-utils/packages/before-exit/src/before-exit.ts'
rpt2: cache: '/Users/alxandr/hub/yolodev-aspnet-utils/packages/before-exit/.rpt2_cache/0df88d81930e5b98b75cf91f784bf1ae5bbd236a/code/cache/2d9c6a3ef228d04e8594fac73f6ee4cdd1c12da5'
rpt2: cache miss
rpt2: cache: '/Users/alxandr/hub/yolodev-aspnet-utils/packages/before-exit/.rpt2_cache/0df88d81930e5b98b75cf91f784bf1ae5bbd236a/syntacticDiagnostics/cache/2d9c6a3ef228d04e8594fac73f6ee4cdd1c12da5'
rpt2: cache miss
rpt2: cache: '/Users/alxandr/hub/yolodev-aspnet-utils/packages/before-exit/.rpt2_cache/0df88d81930e5b98b75cf91f784bf1ae5bbd236a/semanticDiagnostics/cache/2d9c6a3ef228d04e8594fac73f6ee4cdd1c12da5'
rpt2: cache miss
rpt2: generated declarations for '/Users/alxandr/hub/yolodev-aspnet-utils/packages/before-exit/src/before-exit.ts'
rpt2: generating target 1
rpt2: rolling caches
rpt2: generating missed declarations for '/Users/alxandr/hub/yolodev-aspnet-utils/packages/workdir-pid/src/workdir-pid.ts'
rpt2: writing declarations for '/Users/alxandr/hub/yolodev-aspnet-utils/packages/before-exit/src/before-exit.ts' to '/Users/alxandr/hub/yolodev-aspnet-utils/packages/before-exit/dist/before-exit/src/before-exit.d.ts'
rpt2: writing declarations for '/Users/alxandr/hub/yolodev-aspnet-utils/packages/workdir-pid/src/workdir-pid.ts' to '/Users/alxandr/hub/yolodev-aspnet-utils/packages/before-exit/dist/workdir-pid/src/workdir-pid.d.ts'
rpt2: generating target 2
rpt2: rolling caches
rpt2: writing declarations for '/Users/alxandr/hub/yolodev-aspnet-utils/packages/before-exit/src/before-exit.ts' to '/Users/alxandr/hub/yolodev-aspnet-utils/packages/before-exit/dist/before-exit/src/before-exit.d.ts'
rpt2: writing declarations for '/Users/alxandr/hub/yolodev-aspnet-utils/packages/workdir-pid/src/workdir-pid.ts' to '/Users/alxandr/hub/yolodev-aspnet-utils/packages/before-exit/dist/workdir-pid/src/workdir-pid.d.ts'
created packages/before-exit/dist/before-exit.js, packages/before-exit/dist/before-exit.mjs in 1s
Issue Analytics
- State:
- Created 5 years ago
- Reactions:4
- Comments:22 (5 by maintainers)
Top Results From Across the Web
How to use multiple tsconfig files in vs-code? - Stack Overflow
Use a single tsconfig.json for the root. And then extend it for each project (backend tsconfig.server.json , frontend tsconfig.webpack.json ).
Read more >How to Setup a TypeScript project using Rollup.js
It's my first experience using Rollup although I've been working with TypeScript on different projects and using it along other frameworks ...
Read more >rollup.js
To build different bundles with the same input, you supply an array of output options for each input: // rollup.config.js (building more than...
Read more >TSConfig Reference - Docs on every TSConfig option
A TSConfig file in a directory indicates that the directory is the root of a TypeScript or JavaScript project... Compiler Options. Top Level....
Read more >TypeScript rules for Bazel - bazelbuild/rules_nodejs
Allows a tsconfig.json file to extend another file. Normally, you just give a single tsconfig.json file as the tsconfig attribute of a ts_library...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
You can see my setup here: https://github.com/YoloDev/aspnet-node-utils
Same problem, plugin generates wrongs dts paths in lerna environment. d.ts generates in
packages/*/src/dist/<package.name>/src
Look at my project https://github.com/zerkalica/zerollup rollup.config.js
With rootDir uncommented, ts generates errors:
tsconfig.json
Inferno uses ts2 rollup plugin and have same problem with path:
join(__dirname, '../../build/packages/', pkgJSON.name, 'src/index.d.ts')
https://github.com/infernojs/inferno/blob/master/scripts/typings/build.js#L13