CLI extract throws error when using macros
See original GitHub issueDescribe 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:
- Created 5 years ago
- Comments:8 (8 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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.babel-core 7.0.0-0 is the bridge. babel-core officially ends with version 6.