I am trying to create a single .js and .d file for my entire library. this is my package.json:
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": false,
"outDir": "build",
"sourceMap": true,
"removeComments": true,
"watch": false,
"declaration": true,
"outFile": "file.js"
},
"exclude": [
"node_modules",
"build"
]
}
but when I run tsc
I get this error: error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile.
So, how can I do this?
This is a conceptual thing. Commonjs modules are resolved in a way that concatenating them into one file doesn't make sense. See this thread in the TypeScript issues for details:
https://github.com/Microsoft/TypeScript/issues/7252
If you build your library as commonjs, you could of course provide some index file that imports all your other files and exports the parts under separate keys so that you can import the whole lib or only parts of it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With