Tsdx: Change output folder name from "dist" to "build" ?

Created on 26 Nov 2019  路  10Comments  路  Source: formium/tsdx

Current Behavior

I can not find any way to override tsdx output to use any other folder than "dist"

Desired Behavior

Would like to be able to specify another output folder such as "build" instead of "dist"

Suggested Solution

--distFolder option.

Who does this impact? Who is this for?

Users that don't want the generated output in their dist folder.

Describe alternatives you've considered

Manually rename/move generated files.

feature docs

Most helpful comment

It seems like the only way possible to do it at the moment is through tsdx.config.js:

module.exports = {
  rollup(config, options) {
    config.output.file = config.output.file.replace('dist', 'build');

    return config;
  },
};

Regarding how opinionated tsdx wants to be, would be better to have it configurable.

This doesn't work anymore, as tsdx outputs an index.js file to the dist directory, irrespective of rollup's output target

All 10 comments

i havent tried this out yet but have you tried setting it in tsconfig.json? what happens when you do that

It seems like the only way possible to do it at the moment is through tsdx.config.js:

module.exports = {
  rollup(config, options) {
    config.output.file = config.output.file.replace('dist', 'build');

    return config;
  },
};

Regarding how opinionated tsdx wants to be, would be better to have it configurable.

yeah. my inclination is to leave this sort of thing inside rollup config. and document it :)

Would be nice to have some official position about these open requests - not from you specifically, I see that you're more like a community moderator - so that we can create documentation about it (I'd gladly help) but so far we have pending questions only. 馃槙

Same as #321

@arvigeus #321 is quite different, that's asking for a bulk compilation option similar to Babel's --out-dir, not to configure the _name_ of the output directory, as this is. The issues are only similar in title.

It might be good to create a separate FAQ doc around common use-cases that can be implemented with tsdx.config.js and link to it from the README

I'm considering allowing this to be configurable via tsconfig.json's outDir or outFile. Right now both are ignored by TSDX and we should try to make all tsconfig.json work where possible for similar output to tsc and less unexpected unsupported options.

It seems like the only way possible to do it at the moment is through tsdx.config.js:

module.exports = {
  rollup(config, options) {
    config.output.file = config.output.file.replace('dist', 'build');

    return config;
  },
};

Regarding how opinionated tsdx wants to be, would be better to have it configurable.

This doesn't work anymore, as tsdx outputs an index.js file to the dist directory, irrespective of rollup's output target

This doesn't work anymore, as tsdx outputs an index.js file to the dist directory, irrespective of rollup's output target

Good point. It may not have ever worked, that's existed for as long as I know. A post-build script of mv dist/ build/ would accomplish the same thing though and would be less fragile to changes.

My Result

image

Was this page helpful?
0 / 5 - 0 ratings