Skip to content

not possible to run project with ts-node and ts config files #437

Closed

Description

@PavloPoliakov

I'm submitting a ...

  • [ x ] bug report
  • [ ] feature request
  • [ ] support request or question => Please do not submit support request or questions here, see note at the top of this template.

What is the current behavior?

I want to use ts config files AND run my project using ts-node.
Current behaviour - everything fails. I believe that programmatically registered ts-node is conflicting with the one who is running the application.

Here is the reproduction.
Non working repo with ts config files:
https://github.com/PavelPolyakov/config-ts-vs-ts-node/tree/ts
image

Working repo, where config files are js files:
https://github.com/PavelPolyakov/config-ts-vs-ts-node/tree/master
image

What is the expected behavior?

default ts-node application run should work

Please tell us about your environment:

  • node-config version: v6.11.3
  • node-version: v6.11.3

Activity

  1. markstos commented on Oct 6, 2017

    @markstos
    Collaborator
  2. PavloPoliakov commented on Oct 6, 2017

    @PavloPoliakov
    Author

    @markstos
    yes. I've participated this one, for example:
    #416

    Actually I think that there should be no seamless typescript format support in node-config, as usually you need to know (have control on) how your typescript file converts into javascript and executes after.

    But as long as it is present - I think the bug is actual.

  3. electroma commented on Jan 7, 2018

    @electroma

    Face the same issue. The root cause is double registration of ts-node.
    ts-node maintainer has rejected to introduce re-registration fix into ts-node. Actually he said he's going to throw an error in the future version.

    I see several options:

    1. Remove ts-node registration from node-config and expect app code to do it
    2. Add configuration option to allow to disable ts-node re-registration
    3. Detect existing ts(x)-file handler and do not register ts-node in this case

    I like option 3 the most.
    Your thoughts?

  4. added a commit that references this issue on Jan 7, 2018
    36dc3b0
  5. lorenwest commented on Jan 7, 2018

    @lorenwest
    Collaborator

    Can it be determined that ts-node has already been registered? Seems like an easy fix to skip registration if you can make this determination.

  6. lorenwest commented on Jan 7, 2018

    @lorenwest
    Collaborator

    Looks like you've answered that in #458 - approved and merged. Thanks for providing the fix.

  7. added a commit that references this issue on Jan 7, 2018
    035e650
  8. electroma commented on Jan 7, 2018

    @electroma

    Thank you @lorenwest !
    Please let me know how much time will it take to publish new version to the central NPM repo.

  9. lorenwest commented on Jan 7, 2018

    @lorenwest
    Collaborator

    No reason it can't go out today.

  10. lorenwest commented on Jan 7, 2018

    @lorenwest
    Collaborator

    Published today in [email protected]

  11. added a commit that references this issue on Jan 8, 2018
    00e3be1
  12. electroma commented on Jan 8, 2018

    @electroma

    @lorenwest Please merge a little fix of that fix. Sorry about that.

  13. lorenwest commented on Jan 8, 2018

    @lorenwest
    Collaborator

    I was going to ask for a test, but it seemed like a small fix. This time to get this in I'd like you to add a test.

  14. electroma commented on Jan 8, 2018

    @electroma

    @lorenwest done!
    Thank you for keeping the quality bar high!

  15. lorenwest commented on Jan 9, 2018

    @lorenwest
    Collaborator

    Will try to get this in today

  16. added a commit that references this issue on Jan 13, 2018
    63d8e90
  17. lorenwest commented on Jan 13, 2018

    @lorenwest
    Collaborator

    Published to npm @1.29.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions