question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

CLI extract throws error when using macros

See original GitHub issue

Describe the bug I am getting an error when trying to extract messages. It is doing for all my files with translation after I have upgraded to the macros.

To Reproduce

// .babelrc
{
  "presets": [
    "@babel/preset-env",
    "@babel/preset-react",
    "@babel/preset-flow"
  ],
  "plugins": [
    "universal-import",
    "react-hot-loader/babel",
    "babel-plugin-macros",
    "@babel/plugin-syntax-dynamic-import",
    "@babel/plugin-proposal-class-properties",
    "@babel/plugin-proposal-export-default-from",
    "@babel/plugin-proposal-optional-chaining"
  ]
}
// extract command
✔ /Volumes/sites/findoc/src/components/booking/BookingCalendarMultiSpec/DayAvailabilityMultiSpec/index.js
✔ /Volumes/sites/findoc/src/components/booking/BookingCalendarMultiSpec/index.js
⠋ /Volumes/sites/findoc/src/components/booking/bookingSectionTitle/BookingSectionTitle.jsx/Volumes/sites/findoc/node_modules/babel-plugin-macros/dist/index.js:165
    byName[importedName] = path.scope.getBinding(localName).referencePaths;
                                                           ^

TypeError: Cannot read property 'referencePaths' of undefined
    at /Volumes/sites/findoc/node_modules/babel-plugin-macros/dist/index.js:165:60
    at Array.reduce (<anonymous>)
    at applyMacros (/Volumes/sites/findoc/node_modules/babel-plugin-macros/dist/index.js:161:44)
    at /Volumes/sites/findoc/node_modules/babel-plugin-macros/dist/index.js:132:24
    at Array.forEach (<anonymous>)
    at PluginPass.VariableDeclaration (/Volumes/sites/findoc/node_modules/babel-plugin-macros/dist/index.js:122:51)
    at newFn (/Volumes/sites/findoc/node_modules/@babel/traverse/lib/visitors.js:243:21)
    at NodePath._call (/Volumes/sites/findoc/node_modules/@babel/traverse/lib/path/context.js:65:18)
    at NodePath.call (/Volumes/sites/findoc/node_modules/@babel/traverse/lib/path/context.js:40:17)
    at NodePath.visit (/Volumes/sites/findoc/node_modules/@babel/traverse/lib/path/context.js:100:12)
import React from 'react';
import { Trans } from '@lingui/macro';

const BookingSectionTitle = () => (
  <div className="is-size-4 has-text-white has-text-weight-semibold">
    <Trans>Book an appointment online</Trans>
);

export default BookingSectionTitle;

Additional context

  • jsLingui version: 2.7.0
  • Babel version: babel-core: 7.0.0-bridge.0 @babel/core: 7.0.1

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
tricoder42commented, Sep 17, 2018

It’s a bug in babel-plugin-macros https://github.com/kentcdodds/babel-plugin-macros/pull/80

Although I still don’t understand why it works in all examples… I was able to figure out it’s caused by @babel/env preset, other plugins doesn’t affect it at all.

1reaction
tricoder42commented, Sep 15, 2018

babel-core 7.0.0-0 is the bridge. babel-core officially ends with version 6.

On 15 Sep 2018, at 14:03, Daniel K. notifications@github.com wrote:

@tricoder42 Just a not, but in repo, you have “babel-core”: “^7.0.0-0”, but @MartinCerny-awin said he is using the bridge there. I don’t know if there is a relevance, but it could be…

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

Read more comments on GitHub >

github_iconTop Results From Across the Web

VBA On Error - Error Handling Best Practices - Automate Excel
VBA Throw Error / Err.Raise. To through an error in VBA, you use the Err.Raise method. This line of code will raise Run-time...
Read more >
Getting Script Error in Macro Even though it works
Going back to the clicking on the Cubase export window from the other thread, I am just texting with the normal mouse clicks...
Read more >
Error and Return Codes - iMacros
iMacros displays an error message if it encounters an error and stops the current macro run (unless SET !ERRORIGNORE YES is used).
Read more >
Running Shell Script with Macro, Macro stops when it gets to ...
ijm that I'll post below. The macro starts, opens the first image and then runs into an error, it seems like a separate...
Read more >
How can I extract the name of the MACRO present in .xlsm ...
How can I extract the name of the MACRO present in .xlsm files using python ... what is the error, that you are...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found