Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: don't replace lodash/fp imports with lodash-es/fp #884

Merged
merged 2 commits into from
Oct 5, 2020

Commits on Oct 5, 2020

  1. fix: don't replace lodash/fp imports with lodash-es/fp

    - previously, when importing modules from `lodash/fp`, the imports broke
      since `babel-plugin-transform-rename-import` renames all `lodash`
      imports to `lodash-es` for the ESM build
      - e.g `import mergeAll from 'lodash/fp/mergeAll';` ends up being
        imported as `import mergeAll from 'lodash-es/fp/mergeAll'`
        and we got an error since `lodash-es/fp` doesn't exist
    
    - with this fix we use a regex instead of bare string for replacement
      and add a negative lookahead to it so that it doesn't replace
      `lodash/fp` imports
    
    Co-authored-by: Anton Gilgur <agilgur5@gmail.com>
    Altrim Beqiri and agilgur5 committed Oct 5, 2020
    Configuration menu
    Copy the full SHA
    04d10bd View commit details
    Browse the repository at this point in the history
  2. test: ensure lodash-es replacement is done properly

    - lodash for CJS, lodash-es for ESM
    
    - previously, there were no tests for this behavior, so this adds them
      to ensure the replacement continues to work, even with the new
      fix with regex lookahead for `lodash/fp`
    
    Co-authored-by: Anton Gilgur <agilgur5@gmail.com>
    Altrim Beqiri and agilgur5 committed Oct 5, 2020
    Configuration menu
    Copy the full SHA
    c9c6493 View commit details
    Browse the repository at this point in the history