Questions tagged [babel-plugin]
76 questions
3
votes
1 answer
Next.js typescript import aliases with babel-plugin-module-resolver
I'm setting up a Next.js project with typescript. I've been following several guides but I seem to be facing an issue with import aliases.
I'm not sure if this is an issue with my configuration or with Next.js.
Here are a few pages referencing…

J Dubuis
- 492
- 5
- 13
3
votes
0 answers
Add @babel/plugin-proposal-class-properties - with babel.config.js
I am trying to use ConfirmGoogleCaptcha in a React Native app, after installing it I get the following error:
class ConfirmGoogleCaptcha extends Component {
state = {
^
show: false
}
show = () => {
Add…

Cezar Cobuz
- 1,077
- 1
- 12
- 34
3
votes
1 answer
Babel plugin: what's the difference between "transform-object-rest-spread" and "syntax-object-rest-spread"
there are not so much detail in the documentation about these two plugins, I know both of them make syntax like {...obj} works.
But how do I decide which plugin to use ?

Littlee
- 3,791
- 6
- 29
- 61
3
votes
0 answers
dynamically require/import different component modules in React Native depending on build config
I'm working on a React Native project where we will need to build two different flavours of the app, which mostly the same but vary in a few small features. I wanted to see if there was a way to do this through babel somehow, by having different…

Grub
- 844
- 2
- 10
- 21
2
votes
0 answers
Babel plugin "babel-plugin-ramda" is not working with typescript and webpack
I want to use babel-plugin-ramda in my project to shake the dependencies (tree shaking) that is not being used in my project.
When I ran "npm run start", Webpack successfully bundled my TypeScript into my dist folder, but the plugin was ignored by…

Owen Truong
- 33
- 4
2
votes
0 answers
Webpacker/babel issue - can't load Uppy
I have pretty fresh rails application and I'm trying to add uppy file uploader to it. Unfortunately when requiring @uppy/core file I am presented with Cannot assign to read only property 'exports' of object '#

BroiSatse
- 44,031
- 8
- 61
- 86
2
votes
1 answer
How do I run babel-plugin-tester with jest?
It should be very simple this one, but I can't run it. I have installed the plugin according the their docs and written a simple example also according to their docs:
test.js:
import pluginTester from 'babel-plugin-tester'
pluginTester({
plugin:…

user2908112
- 457
- 6
- 18
2
votes
2 answers
Babel Plugin: How to insert a sibling node
It seems that path.insertAfter(), path.insertBefore(), path.unshiftContainer(), and path.pushContainer() only work with Statements. How do you insert nodes that are not Statements?
In my case I am writing a babel jsx plugin and I am trying to insert…

curiousgeorge
- 593
- 1
- 5
- 14
2
votes
2 answers
What's the difference between "Visitor.Program.enter()" and "pre()" in a Babel plugin?
This Babel plugin:
module.exports = function(){
return {
visitor:{
Program:{
enter(){ console.log('Enter') },
exit(){ console.log('Exit') }
}
},
pre(){…

GetFree
- 40,278
- 18
- 77
- 104
2
votes
0 answers
Babel transpile async/away but keep class
I'm new to Babel and want to know how I can keep my ES6 classes while transpiling async/await to es6/5.
Every time I try to transpile and bundle it with Webpack, the classes, which are supported in Chrome 53, are transpiled…

Sascha
- 21
- 2
2
votes
1 answer
VS Code error messages and Babel plugins
How can I use this plugin
https://github.com/babel/babel/tree/master/packages/babel-plugin-proposal-pipeline-operator
And stop VS Code from bugging me about the |> operator without completely turning off error checks?
Any suggestions appreciated!

Babakness
- 2,954
- 3
- 17
- 28
2
votes
1 answer
babel-plugin-root-import wrong path using react-native 0.43.3
I'm calling it like so: import { SplashContainer, FooterTabsContainer, SettingsContainer } from '~/containers'
it should be reading from directory /Users/jasan/Desktop/ReactModoro/app/containers
It seems to add app/containers/Navigator in the…

jasan
- 11,475
- 22
- 57
- 97
1
vote
0 answers
Babel prepend javascript on top of a file
I am trying to prepend Javascript to a javascript file using a babel plugin. This is my current babel plugin.
const babel = require("@babel/core")
module.exports = () => {
return {
visitor: {
Program: {
…

PowerKuu
- 63
- 7
1
vote
1 answer
traversing unvisited nodes in Babel
I want to traverse some of the string literals in one traversal and generate the ouput. and the string literals that are not visited in the first traversal should be traversed in the second traversal. the rule that which string literals should be…

saha
- 23
- 5
1
vote
1 answer
Babel plugin addComment doesn't work when ran with codemod
I've created a babel plugin:
module.exports = function (babel) {
const { types: t } = babel;
return {
name: 'addComment',
visitor: {
Program(path, state) {
…

konclave
- 648
- 1
- 7
- 19