Questions tagged [babel-plugin]

76 questions
1
vote
0 answers

react-scripts 2.1.1 update fails

My task is to update "react-scripts" 2.1.1 in ReactJS app to something newer. what I did: 1. clone clean project update "react-scripts": "2.1.1" -> "2.1.8" npm install npm start First problem, which I faced: frontend@2.0.0 start…
1
vote
1 answer

what is the different between webpack loader and babel-plugin?

In my opinion, webpack-loader has the same function as babel-plugin!! So can you help me answer the difference between the two, isn't it all through the AST to manipulate the code?
Cart
  • 11
  • 2
1
vote
0 answers

Using Babel plugin to convert JSX attribute into a function call

I'm looking to try and transform the outputted value of a JSX attribute from a string to an expression/function call. Given the source code looks something like... function dynamicClasses() { //... do something } export default () =>
owenmelbz
  • 6,180
  • 16
  • 63
  • 113
1
vote
1 answer

How to use babel-plugin-module-resolver to set an alias for the root path and disable other root imports?

I would like to do imports like this import Foo from '~/components/Foo' https://github.com/tleunen/babel-plugin-module-resolver If I set my .babelrc to: { "plugins": [ ["module-resolver", { "root": "./", "alias": { "~/":…
corysimmons
  • 7,296
  • 4
  • 57
  • 65
1
vote
0 answers

How to apply babel plugin for certain dependency?

I have write a Babel plugin for transpiling some specific dependencies. To reduce the compiling time of babel, I want to only use it for these dependencies, my babel.config.js is like module.exports = { plugins: [["plugin-a"], ["plugin-b"]] …
Haven
  • 7,808
  • 5
  • 25
  • 37
1
vote
1 answer

React - i18next-extract: Question about extractedTranslations output

I'm using this babel plugin https://github.com/gilbsgilbs/babel-plugin-i18next-extract. Haven't configured it much beyond the basics. it generates an extractedTranslations folder but I just end up with keys and no values. Is that the correct…
hamobi
  • 7,940
  • 4
  • 35
  • 64
1
vote
0 answers

Why simple babel plugin breaks jest test?

I wrote a simple plugin: export default function() { return { visitor: { Program: { enter() { console.log('Program Entered!'); }, exit() { …
Vadim
  • 3,474
  • 3
  • 14
  • 21
1
vote
0 answers

Detecting in a babel plugin whether a file is a module or a script

I'm writing a babel plugin that adds a polyfill at the top of a module. I'd like to use one strategy for EcmaScript modules, and assume otherwise that its a CommonJS module. So I've got something like module.exports = function…
Mike Samuel
  • 118,113
  • 30
  • 216
  • 245
1
vote
1 answer

Babel plugin error unknown node of type undefined with constructor "String"

I am building a shared component library that will be used by both React and Vue. I am using Styletron, which requires a framework-specific adapter, but otherwise works pretty much the same. So from my source code (a bunch of functions) I need to…
Erik Hellman
  • 269
  • 1
  • 2
  • 11
1
vote
2 answers

Unable to resolve module when building react-native .apk, babel-plugin-module-resolver aliases

I am using babel-plugin-module-resolver to deal with ../../../ hell. In my .babelrc I have: { "presets": [ "react-native", "babel-preset-react-native-stage-0/decorator-support", "react-native-dotenv" ], "env": { "development":…
1
vote
0 answers

How to Ignore Third Party Component css files while using babel-plugin-react-css-modules

I have this situation where in one of my Component JSX file (For Eg. List.jsx) is importing the styles as follows : import styles from "./css/list.rcss"; import "fixed-data-table.css"; import "./css/fixed-data-table.css"; 1st import, the .rcss…
iG9
  • 11
  • 2
0
votes
0 answers

Error: [BABEL] /app/src/index.js: Cannot find module '@babel/plugin-proposal-private-property-in-object

After a successful build using npm run build and then a successful Heroku deployment, I get this runtime error in the browser I've followed instructions from this GitHub issue and placed the proper version in both my "dependencies" and…
0
votes
0 answers

@babel/plugin-proposal-class-properties not being recognised

I am currently trying to include into my app the component Feathery React Forms However, after I install the module, and importing it into a component, this message always appear. ./node_modules/react-idle-timer/dist/index.esm.js SyntaxError:…
0
votes
0 answers

Disable babel's escaping of characters in stringLiteral

It seems babel is doing some automatic escaping of special characters when using t.stringLiteral which causes problems for me. Is there any way to disable this behaviour or a workaround perhaps? stringBabelPlugin.js const t =…
Cotten
  • 8,787
  • 17
  • 61
  • 98
0
votes
0 answers

babel-plugin-react-css-modules is converting styleName to className but classnames not changed in css file

I'm trying to setup babel-plugin-react-css-modules , The conversion of styleName to class and its injection is happening properly, but the styles are not getting applied, after inspection I came to know that the class names are not updated in css…