Skip to content

pass babel options to extraction#226

Closed
djfarly wants to merge 3 commits into
lingui:stable-2.xfrom
djfarly:babel-opts
Closed

pass babel options to extraction#226
djfarly wants to merge 3 commits into
lingui:stable-2.xfrom
djfarly:babel-opts

Conversation

@djfarly

@djfarly djfarly commented Jun 13, 2018

Copy link
Copy Markdown
Contributor

Hey ❤️

We are using extract programmatically (heavily customised) instead of via cli. Because our babel options are only ever known at build time, we cannot use the .babelrc file (we do currently by emitting the file, and deleting it after extraction).
By allowing us to pass down options to babel this alleviates a lot of pain.
I know his is kind of a special use case, but i don't see any downsides of having the option to do it.

There is a failing test case, but i cannot make any sense of it currently – maybe I am to tired.

 FAIL  packages/cli/src/api/extract.test.js
  ● extract › should traverse directory and call extractors

    expect(jest.fn()).toHaveBeenCalledWith(expected)

    Expected mock function to have been called with:
      Did not expect argument 3 but it was called with undefined.

      65 |     expect(babel.extract).not.toHaveBeenCalledWith(
      66 |       path.join("src", "index.html")
    > 67 |     )
      68 |
      69 |     expect(babel.extract).toHaveBeenCalledWith(
      70 |       path.join("src", "components", "Babel.js"),

      at Object.<anonymous> (packages/cli/src/api/extract.test.js:67:27)

Any thoughts? Am I making sense? 😄

Cheers, Jan!

@tricoder42 tricoder42 changed the base branch from master to stable-2.x June 24, 2018 05:58
@tricoder42 tricoder42 closed this in 79a22fe Jul 4, 2018
@tricoder42

Copy link
Copy Markdown
Contributor

Fixed and released in v2.2.0. Thanks to all involved!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants