-
Notifications
You must be signed in to change notification settings - Fork 70
Open
Labels
kind: featureNew feature or requestNew feature or requestsolution: workaround availableThere is a workaround available for this issueThere is a workaround available for this issuetopic: TS versionRelated to a change in a TS versionRelated to a change in a TS version
Description
currently
With this plugin I generate index.cjs via rollup and this plugin generates the index.d.ts next to it.
desired
how can I set the generated index.d.ts file to be called index.d.cts instead?
Versions
System:
OS: macOS 13.3.1
CPU: (8) arm64 Apple M2
Memory: 309.73 MB / 24.00 GB
Shell: 3.6.0 - /opt/homebrew/bin/fish
Binaries:
Node: 16.20.0 - /usr/local/bin/node
Yarn: 1.22.19 - /usr/local/bin/yarn
npm: 8.19.4 - /usr/local/bin/npm
npmPackages:
rollup: ^3.22.0 => 3.22.0
rollup-plugin-typescript2: ^0.34.1 => 0.34.1
typescript: ^5.0.4 => 5.0.4
rollup.config.js
:
rollup.config.jsimport typescript from 'rollup-plugin-typescript2'
import pkg from '../package.json' assert { type: 'json' }
export default {
input: 'src/index.ts',
output: [
{ file: pkg.exports['.'].require.default, format: 'cjs' },
{ file: pkg.exports['.'].import.default, format: 'esm' },
],
external: Object.keys(pkg.dependencies || []),
plugins: [typescript({ tsconfigOverride: { exclude: ['test/**/*'] } })],
}tsconfig.json
:
tsconfig.json{
"compilerOptions": {
"allowJs": false,
"baseUrl": ".",
"declaration": true,
"downlevelIteration": true,
"esModuleInterop": true,
"isolatedModules": true,
"lib": ["esnext", "DOM", "DOM.Iterable"],
"module": "esnext",
"moduleResolution": "node",
"noImplicitReturns": true,
"noUnusedLocals": true,
"skipLibCheck": true,
"sourceMap": true,
"strict": true,
"target": "es2019",
"useDefineForClassFields": true
},
"include": ["src/**/*", "test/**/*"]
}package.json
:
package.json "sideEffects": false,
"type": "module",
"types": "./dist/index.d.ts",
"module": "./dist/index.js",
"main": "./dist/index.js",
"exports": {
".": {
"require": {
"types": "./dist/cjs/index.d.ts",
"default": "./dist/cjs/index.cjs"
},
"import": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
}
},
"files": [
"dist"
],
"engines": {
"node": ">=12.13"
},gyurielf
Metadata
Metadata
Assignees
Labels
kind: featureNew feature or requestNew feature or requestsolution: workaround availableThere is a workaround available for this issueThere is a workaround available for this issuetopic: TS versionRelated to a change in a TS versionRelated to a change in a TS version