Fable: Inconsistent file extension when specifying an output directory with Fable 3

Created on 26 Oct 2020  路  5Comments  路  Source: fable-compiler/Fable

Description

Compile App.fs with Fable 3 and the output file will be App.fs.js (extension .fs.js). Specify an output directory with --outDir and the output file will be App.js (extension .js). I think the file name should be consistent and not depend on the output directory.

Related information

  • Fable version: 3.0.0-nagareyama-beta-003
  • Windows 10

Most helpful comment

  • Support for the --extension compiler option has been improved in beta-005 and above.
  • You can now force the same extension (with or without --outDir) by passing the --extension compiler option.
  • If there is no --extension option, the default extension will be .fs.js without --outDir and .js with --outDir,
    or if --typescript is also defined, the default extension will be .fs.ts without --outDir and .ts with --outDir.

Personally I think the defaults make sense for reasons stated above, as long as they're documented, but other opinions are welcome.

All 5 comments

Actually, this was somewhat intended. The .fs.js extension is meant to be easy to add to .gitignore, but when using an output directory, this is usually already ignored so we can just use .js. But I understand your point. @ncave implemented the --outDir feature, do you have any thoughts on this?

IMO both have merits as @alfonsogarciacaro explained, but to eliminate confusion we can make the --extension parameter work consistently in both cases (if defined), then we can discuss sensible defaults if --extension is not provided. I can take a crack at that.

  • Support for the --extension compiler option has been improved in beta-005 and above.
  • You can now force the same extension (with or without --outDir) by passing the --extension compiler option.
  • If there is no --extension option, the default extension will be .fs.js without --outDir and .js with --outDir,
    or if --typescript is also defined, the default extension will be .fs.ts without --outDir and .ts with --outDir.

Personally I think the defaults make sense for reasons stated above, as long as they're documented, but other opinions are welcome.

Sounds reasonable! IMHO this issue can be closed :).

Thanks @bklop! Ok, let's close the issue for now and we can revisit later if necessary when getting feedback from other Fable 3 users :+1:

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jwosty picture jwosty  路  3Comments

tomcl picture tomcl  路  4Comments

alfonsogarciacaro picture alfonsogarciacaro  路  3Comments

rommsen picture rommsen  路  3Comments

alfonsogarciacaro picture alfonsogarciacaro  路  3Comments