tscb
v1.0.1
Published
A lightweight TypeScript packaging library.
Downloads
5
Maintainers
Readme
tscb
A lightweight TypeScript packaging library that solves the issue of tsconfig not being able to output both cjs and esm files simultaneously.
Install
npm install tscb
Usage
tscb
will read the configuration from tscb.config.js
or package.json
, and any new configuration will overwrite the settings in the project's tsconfig.json
.
// package.json
{
"tscb": [
{
"compilerOptions": {
"module": "es2015",
"outDir": "dist",
"declaration": true
}
},
{
"compilerOptions": {
"module": "commonjs",
"outDir": "dist/cjs"
},
"include": ["lib"]
}
]
}
// tscb.config.js
module.exports = [
{
compilerOptions: {
module: 'es2015',
outDir: 'dist',
declaration: true,
},
},
{
compilerOptions: {
module: 'commonjs',
outDir: 'dist/cjs',
},
include: ['lib'],
},
]
Please note, if your project is set to "type": "module"
, you need to change the configuration file suffix to cjs - tscb.config.cjs
.
Run the tscb
command
tscb
or
npx tscb
Command Line Arguments
tscb [--config /path/to/config] [--project /path/to/tsconfig]
API
import { tscb } from 'tscb'
tscb({
compilerOptions: {
module: 'commonjs',
outDir: 'dist/cjs',
},
include: ['lib'],
})