babel: @babel/plugin-proposal-object-rest-spread not being detected at beta.46
Babel/Babylon Configuration (.babelrc, package.json, cli command)
.babelrc
{
"presets": [
["@babel/env", {
"targets": { "node": "6.11.5" }
}]
],
"plugins": ["@babel/plugin-proposal-object-rest-spread"]
}
CLI Command
babel 'functions/src' --out-dir 'functions/bundle' --copy-files --ignore 'functions/src/node_modules'
Expected Behavior
Files are correctly built, as it did with beta.44
Current Behavior
With beta.46, following error arises:
Error: SyntaxError: functions/src/common/getLocations.js: Support for the experimental syntax 'objectRestSpread' isn't currently enabled (77:19):
75 | if (key === 'viewport'){
76 | const { northeast, southwest } = geometry.viewport;
> 77 | return {...prev, bounds : {
| ^
78 | ne : {
79 | lat : northeast.lat,
80 | lng : northeast.lng
Add @babel/plugin-proposal-object-rest-spread (https://git.io/vb4Ss) to the 'plugins' section of your Babel config to enable transformation.
at /Users/karlas/project/node_modules/@babel/cli/lib/babel/dir.js:185:22
at /Users/karlas/project/node_modules/@babel/cli/lib/babel/dir.js:148:23
at /Users/karlas/project/node_modules/@babel/cli/lib/babel/dir.js:120:23
at /Users/karlas/project/node_modules/@babel/cli/lib/babel/dir.js:82:23
at /Users/karlas/project/node_modules/@babel/cli/lib/babel/util.js:126:16
at runAsync (/Users/karlas/project/node_modules/@babel/core/lib/transformation/index.js:37:12)
at /Users/karlas/project/node_modules/@babel/core/lib/transform-file.js:56:36
at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:511:3)
Possible Solution
Can’t help…
Context
Just transpiling about 20 files to be used on Firebase Functions
Your Environment
software | version(s) |
---|---|
Babel | 7.0.0-beta.46 |
node | 8.11.1 |
npm | 5.6.0 |
yarn | 1.6.0 |
Operating System | macOS High Sierra |
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 10
- Comments: 15 (3 by maintainers)
Commits related to this issue
- Fix Babel config loading See: https://github.com/babel/babel/issues/7879 — committed to serverless/components by pmuens 6 years ago
- Fix Babel config loading See: https://github.com/babel/babel/issues/7879 — committed to serverless/components by pmuens 6 years ago
.babelrc.js
in prj root worked until beta.44, but doesn’t in 45 and aboveMmm i can´t get it work. What i made:
functions/src/.babelrc
tofunctions/src/babel.config.js
module.exports
to this file, resulting:Am I doing something wrong?
oh… why
babel.config.js
, looks so bad.2 hours wasted pulling my hair out with this one. This should probably be in big bold letters at the head of the repo 🤣 It’s going to trip a lot of people up. Renaming to
babel.config.js
and exporting works fine.Can you try to rename
babel.config.js
andmodule.export
the configuration? We changed how config loading works and it is causing a bunch of problems.Same for me, it was a lot of pain for me to upgrade babel version and make everything work. After a lot of searches, I renamed .babelrc to babel.config.js et voila !