Skip to content

wrap the import? #3

Open
Open

Description

@oliviertassinari

I'm wondering if it would aslo make sens to let the plugin wrap the import/require of the warning dependency with a process.env.NODE_ENV !== 'production' block.

That shouldn't make any different when using a flat bundler like rollup but I think that would save us some module tree traversal when using a bundler like webpack.

Activity

  1. taion commented on Aug 23, 2016

    @taion
    Contributor

    Could work. Right now this is a literal copy/paste of https://github.com/facebook/fbjs/blob/master/packages/babel-preset-fbjs/plugins/dev-expression.js. That would take it away a bit.

    It wouldn't necessarily be 100% maybe? e.g. I use it for https://github.com/reactjs/react-router/blob/8707d05b00273590e4d054771b8ae7ae9ad312e3/modules/RoutingContext.js#L3. But maybe that doesn't matter.

  2. anilanar commented on Feb 13, 2017

    @anilanar

    There's one catch to this proposal: wrapping an import is not valid ES6 and will cause babel to complain as such:

    'import' and 'export' may only appear at the top level

    However, I don't see harm in making it an option.

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