Questions tagged [babel-cli]

61 questions
3
votes
0 answers

Babel: Update relative paths when transpiling

At the moment I am trying to transpile a JavaScript project which is written using EC6 with Babel. I used the Babel CLI with the following command: babel my-project --ignore node_modules --out-dir my-project-compiled --copy-files which transpiles…
Daniel Wehner
  • 223
  • 1
  • 2
  • 7
3
votes
1 answer

Can't launch VSCode debugger for node with babel-node

When I type npm run debug into the console I get: "Debugger listening on ws://127.0.0.1:3090/d17dfe56-4fa4-4686-a62e-d07cff78c834". When I go to this adress in chrome the only thing I see is "WebSockets request was expected". What parts of my config…
Umbrella
  • 1,085
  • 1
  • 14
  • 30
3
votes
1 answer

Using babel-polyfill in production entry file

I'm using babel to transpile ES7 js code, and everything works like a charm in dev/staging. Inside the application, I heavily rely on async/await features of ES7. My entry file looks like this: 'use…
Ivan
  • 769
  • 5
  • 17
2
votes
0 answers

How to use tsconfig.json in babel

I'm building a script that compiles Monorepo packages, I'm using typescript, each package has its own typescript config. I want to tell @babel/preset-typescript which config file to use.
Ali Turki
  • 1,265
  • 2
  • 16
  • 21
2
votes
0 answers

React on Web - Uncaught SyntaxError: Cannot use import statement outside a module

On hour four of working this out, I'm really sorry if there's a duplicate but I just looked through all of the suggestions and anything similar, but I need help! I am reasonably new to React (ReactJS) and wanted to implement an app inside of a…
user2472505
2
votes
0 answers

How to use regex in babel include parameter in babel cli?

I want to transpile the contents of my src directory as well as some packages in node_modules with the help of babel . I'm using the following command as my npm script in package.json: "build": "babel ./packages/myproject/src --include…
hitchhiker
  • 1,099
  • 5
  • 19
  • 44
2
votes
1 answer

How to fix 'path.inShadow is not a function', when transpiling code using grunt/babel

Transpiling javascript code using babel-cli via grunt. Seeing error "path.inShadow is not a function" when transpiling first javascript file containing a class definition. I believe that I have fully updated node and all of the packages (I'm new to…
dbp
  • 91
  • 1
  • 12
2
votes
1 answer

Stop Babel compiling jsx code?

Most information and answers deal with issues of babel not compiling into JSX. In my case, I use .jsx as a templating engine, so I want babel to compile .js files but not .jsx files. Still I want to copy the files to a build/dist folder. My app…
carkod
  • 1,844
  • 19
  • 32
2
votes
0 answers

Acessing server files from client directory and the other way using create-react-app and babel-node

I have an ejected create-react-app client application and a server side application in the same bundle in a Windows 10 environment. My directory structure is as follows: app |--------- server.js |--------- package.json |--------- start-client.js …
Mendes
  • 17,489
  • 35
  • 150
  • 263
2
votes
0 answers

Compiling a CSS Modules enabled library for NPM Publishing

I am creating a library which leverages CSS Modules (babel-plugin-react-css-modules) along with SASS. I dont want the consumers of my library to be worried about CSS Modules and SASS and have the appropriate rules setup in their bundler to enable…
jVenki
  • 93
  • 3
2
votes
1 answer

Async Generator works on babel-node but fails w/ babel-register or build

Using babel-node I was able to run the following code function timeout(ms = 100) { return new Promise(resolve => { let id = setTimeout(() => { clearTimeout(id) resolve(ms) }, ms) }) } async function*…
vvMINOvv
  • 1,768
  • 4
  • 22
  • 45
2
votes
0 answers

Transpile ES6 Generators with Babel in the browser

I am able to transpile ES6 with babel but when I tried to test generators, I got this exception. Uncaught ReferenceError: regeneratorRuntime is not defined I looked around and found out that I have to add bable-generator and runtime plugins. I added…
Yasin Yaqoobi
  • 1,888
  • 3
  • 27
  • 38
1
vote
1 answer

Babel skip logging the transpiled script to console

yarn run babel -f babel.config.js is logging all the transpiled scripts to the console by default. Is there an option in Babel to skip logging the transpiled javascript to Console?
Northstar
  • 323
  • 4
  • 16
1
vote
1 answer

Manually Transpiling React JSX with Babel-cli

How can I compile a .jsx file using the npx babel-cli [inpfile].jsx --out-file [outfile].js --plugin=@[someplugin] command. I have tried --plugin=@plugin-transform-react-jsx but it gives error on the very first JSX expression. I have babel-cli,…
abdullahQureshee
  • 322
  • 2
  • 12
1
vote
0 answers

Babel-CLI -- Using a package.json file to "watch" a directory does not update the compiled source

The goal here is to watch a directory and output the new files. When saved it should .... take every file in the directory and minify it transpile every file that needs transpiling add the minified file and the map in the same directory What's…
John David
  • 388
  • 1
  • 4
  • 18