Closed alonfai closed 4 years ago
This feature already exists, there is a --tsconfig
flag for this.
Duplicate of #121 / #124
With regard to your code snippet and error message, that's happening because you added rpts2 a second time to the end of the existing plugins list (running it after the rest), and without the same settings. You have to replace the existing rpts2 and duplicate settings for modifications to work. It's non-trivial and very fragile per the warning.
@agilgur5 Thanks for answering that. I found another issue relating to changing the output folder
I modify both the rollup output
param and the tsconfig.json outDir
and declarationDir
to a parent folder of my project that is used for debugging my app that consumes the bundled output.
tsconfig.json
"compilerOptions": {
"baseUrl": "./src",
"outDir": "../../my-app/src/@scope/shared",
"declarationDir": "../../my-app/src/@scope/shared"
"allowJs": true,
"alwaysStrict": true,
"declaration": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"importHelpers": true,
"jsx": "react",
"lib": ["dom", "esnext"],
"module": "esnext",
"moduleResolution": "node",
"noFallthroughCasesInSwitch": true,
"noImplicitThis": true,
"strictFunctionTypes": true,
"strictPropertyInitialization": true,
"strict": true,
"allowSyntheticDefaultImports": true,
"noUnusedParameters": false,
"noUnusedLocals": false,
"strictNullChecks": true,
"noImplicitAny": false,
"noEmit": true,
"target": "es5",
"sourceMap": true,
"downlevelIteration": true
}
tsdx.config.js
module.exports = {
rollup(config, options) {
return {
...config,
// https://github.com/formium/tsdx/issues/213#issuecomment-540126058
output: {
...config.output,
// dir: path.join(__dirname, '../../my-app/src/@scope'),
file: `../../my-app/src/@scope/shared/${path.basename(file)}`
}
}
}
}
};
The resulting run of tsdx build gives me the bundled esm/cjs for both development/production .js builds with the relevant typings, however I still have a dist
folder under my scoped rollup project with the entry index.js file.
I attached a few pics to demonstrate the issue.
// current tsdx/rollup project with a single index.js under `shared/dist folder
'use strict'
if (process.env.NODE_ENV === 'production') {
module.exports = require('./shared.cjs.production.min.js')
} else {
module.exports = require('./shared.cjs.development.js')
}
// The other project that consumes the bundled output
That is an unrelated issue so I've marked it as off-topic, please keep issues single topic, it creates confusion otherwise.
And that is also a duplicate of https://github.com/formium/tsdx/issues/351#issuecomment-657284291 ....
Current Behavior
The tool currently uses the local defined in root directory tsconfig.json.
Desired Behavior
I want to override the given config file to refer to a different tsconfig.development.json or tsconfig.release.json, which currently isn't possible. I tried import the given
rollup-plugin-typescript2
that tsdx uses and give a differenttsconfig
prop ortsconfigOverride
property, but got an error relating to babel.Suggested Solution
Need an easy way to overwrite the given typescript settings in the project