Questions tagged [babel-plugin]
76 questions
10
votes
1 answer
How to add Babel support for nullishCoalescingOperator to vue project?
In my Vue-CLI project, when I tried using the ?? operator, I got this error:
Syntax Error: SyntaxError: /Users/stevebennett/odev/freelancing/v-map/src/components/Map.vue: >Support for the experimental syntax 'nullishCoalescingOperator' isn't…

Steve Bennett
- 114,604
- 39
- 168
- 219
7
votes
1 answer
React-App- Rewired won't add Babel Plugin
So I am trying to run react-native using react-native-web. It requires some babel plugins to be added.
My app was created using react-app-rewired. I have tried several ways to add the babel plugin, however, with no success.
I am using a…

Gal Gendler
- 191
- 1
- 6
7
votes
1 answer
How to overwrite babel's preset plugin options
I'm using babel-preset-react-app via following .babelrc:
{
"presets": ["react-app"],
"plugins": [
"transform-es2015-modules-commonjs",
"transform-async-generator-functions"
]
}
I need to overwrite babel-plugin-transform-runtime…

Boris Zagoruiko
- 12,705
- 15
- 47
- 79
6
votes
2 answers
How to use root option in babel-plugin-module-resolver?
I'm trying to use babel-plugin-module-resolver in a react-native app. When I use plugin config like this in babel.config.js it works perfectly.
plugins: [
[
'module-resolver',
{
extensions: ['.ios.js', '.android.js', '.js',…

Mahdi N
- 2,128
- 3
- 17
- 38
6
votes
3 answers
How do I traverse the scope of a Path in a babel plugin
I'm trying to write a simple babel plugin, but I am having a hard time traversing a matched node with a nested visitor. I would like to find all require calls in a module that require a certain module and then apply some transformation in the same…

m90
- 11,434
- 13
- 62
- 112
4
votes
0 answers
react native error: Export namespace should be first transformed by `@babel/plugin-proposal-export-namespace-from`
I'm encountering an error while loading my app to my IOS via ExpoGo. I've tried the solutions offered by threads describing the same issue which I've linked at the end of this post but I'm still getting the same error. I wasn't using…

ahauser
- 55
- 5
4
votes
1 answer
How to Enable Private Method Syntax Proposal in React App?
I got "Class private methods are not enabled." error when running npm start on a project using leading # to indicate private methods.
I followed this answer: https://stackoverflow.com/a/55822103/4258041 to enable the decorator and it worked, but I…

Yan Yang
- 1,804
- 2
- 15
- 37
4
votes
2 answers
What is the type of a Babel plugin parameter written in TypeScript?
I am writing a Babel plugin in TypeScript and have been struggling to find a lot of examples or documentation doing so. For example, I am writing a visitor plugin with the following signature:
export default function myPlugin({ types: t }: typeof…

Nicolas Bouvrette
- 4,295
- 1
- 39
- 53
4
votes
0 answers
Configure custom "root" directory with "babel-plugin-module-resolver"?
Here is my project structure:
cloudRun
distApp // TRANSPILED APP FILES FROM ./src
distService // TRANSPILED BACKEND FILES FROM ./cloudRun/src
src // SOURCE FILES FOR THE BACKEND CODE
index.js // INDEX.JS…

cbdeveloper
- 27,898
- 37
- 155
- 336
4
votes
1 answer
How to fix "Support for the experimental syntax 'classProperties' isn't currently enabled" error if it has been already enabled?
Im building a crossplatform monorepo application for Web, Android and iOS from this example https://github.com/brunolemos/react-native-web-monorepo and when I added React Native Base to my project I changed my config-overrides.js according to this…

Max Lyaskovskiy
- 41
- 1
- 4
4
votes
1 answer
How to write a babel js plugin that passes output to other plugins?
I'm trying to write a babel plugin that prepends/appends content to a file - for example; add the lines console.log("start of " + __filename); and console.log("end of " + __filename); to each file.
So far, I've managed to write a visitor that does…

Micheal Hill
- 1,619
- 2
- 17
- 38
4
votes
0 answers
Graphql query statements `graphql` not being interpreted by babel-plugin-relay
I´m trying to setup GraphQL on my Realy Modern application, but babel is not working with my grapqh queries.I´m getting the following runtime error:
graphql: Unexpected invocation at runtime. Either the Babel transform was not set up, or it failed…

Mendes
- 17,489
- 35
- 150
- 263
3
votes
0 answers
Enable import assertions for Babel in node.js
import data from './data.json' assert {type: "json"};
Got the below error message,
Add @babel/plugin-syntax-import-assertions (https://git.io/JUbkv) to the 'plugins' section of your Babel config to enable parsing.
Added the following in .babelrc…

Johnson Samuel
- 2,046
- 2
- 18
- 29
3
votes
0 answers
How to tree-shake Lodash and Mui imports in Storybook 5
I'm using Mui and Lodash in my CRA project with Storybook 5.
I successfully tree-shake both Mui and Lodash imports using babel-plugin-import in CRA, using the following .bablerc.js
module.exports = {
presets: ["react-app",…

Michal Kurz
- 1,592
- 13
- 41
3
votes
1 answer
ESLINT: ESLINT Error: ESLint configuration in ..\..\..\..\.eslintrc is invalid: - Unexpected top-level property "import/extensions"
im using airbnb-eslint along with babel-plugin-module-resolver. I get this error in every js file where i've used an alias to import.
{
"extends": ["plugin:import/errors", "plugin:import/warnings", "airbnb", "airbnb/hooks", "prettier",…

ashwin1014
- 351
- 1
- 5
- 18