Skip to content

Ability to set useESModules to false聽#5452

Closed

Description

@ivosabev

It seems to me that there is no way in which this settings can be set to false? It could not be overwritten in a babel.config.js neither 馃槥

https://github.com/facebook/create-react-app/blob/f89385f7438f39750b762590ebd9729534e30190/packages/babel-preset-react-app/create.js#L143

Activity

  1. Timer commented on Oct 16, 2018

    @Timer
    Contributor

    We can take this as an option. May I ask your use case?

  2. Pajn commented on Oct 19, 2018

    @Pajn
    Contributor

    I just hit on the same problem.

    My use case is that I use a combined build process for everything for which babel-preset-react-app is the base but with additional plugins for things in the node environment. This has worked good previously but when I try to update to the new version I of course get syntax errors on the import syntax.

    Being able to disable useESModules would really help me as I then can avoid forking babel-preset-react-app

  3. ivosabev commented on Oct 20, 2018

    @ivosabev
    Author

    I have the same use case as @Pajn, I am using the babel-preset-react-app as the babel config for helper libraries and my node servers. It used to work good before version 2.0. I have recently found another problem that is breaking:

    https://github.com/facebook/create-react-app/blob/473fde0e1c5cca2c4c04f63b25348f6097ef4cc2/packages/babel-preset-react-app/create.js#L147

    When I build my node server it includes absolute paths, which it shouldn't and there is no way to stop this.

    I think the best solution would be if we can overwrite those settings, when using the babel-preset-recat-app package as a standalone babel preset. I have opened an issue with Babel about this, but they have not responded yet.

    babel/babel#8799

  4. bugzpodder commented on Oct 20, 2018

    @bugzpodder

    @ivosabev you can disable runtime path: #5443 (comment)

  5. stale commented on Nov 19, 2018

    @stale

    This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 5 days if no further activity occurs.

  6. Timer commented on Nov 19, 2018

    @Timer
    Contributor

    PR up in #5487

  7. strayiker commented on Dec 5, 2018

    @strayiker

    Can this option be applied to the env preset?
    https://github.com/facebook/create-react-app/blob/013c8f2c733ef2022c138d69207297cc25a62d60/packages/babel-preset-react-app/create.js#L93-L94
    This will allow us to transpile the whole CRA application code for ssr needs.
    Also, it will be more obvious if useEsModules: false will be guaranty that transpiled code does not contains esm statements.

  8. Timer commented on Dec 6, 2018

    @Timer
    Contributor

    I don't see why not, send a PR?

  9. locked and limited conversation to collaborators on Jan 9, 2019
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