Null-safe property access (and conditional assignment) in ES6/2015

Is there a null-safe property access (null propagation / existence) operator in ES6 (ES2015/JavaScript.next/Harmony) like ?. in CoffeeScript for example? Or is it planned for ES7? var aThing =...

"You may need an appropriate loader to handle this file type" with Webpack and Babel

I am trying to use Webpack with Babel to compile ES6 assets, but I am getting the following error message: You may need an appropriate loader to handle this file type. | import React from...

Module.exports and es6 Import

React with babel. I have this confusion with imports and module.exports. I assume babel when converting the ES6 code to ES5 converts the imports and exports to require and module.exports...

ReferenceError: global is not defined at eval

I'm experiencing an error that I believe is from webpack's side. Here it is: index.js:9 Uncaught ReferenceError: global is not defined at eval (index.js:9) at Object.<anonymous>...

ESLint shows error on class instance property initialized to arrow function

maybe similar to https://stackoverflow.com/questions/34244888/how-do-i-configure-eslint-to-allow-fat-arrow-class-methods When class method defined as arrow function Eslint highlight error 'method'...

Installing Babel to use with React and JSX

I'm new to React and Babel and JSX. I'm trying to figure out how to install Babel so it will "do the right thing" with React and JSX in the browser. However, the documentation for Babel assumes...

Babel 7 fails with single plugin saying "Duplicate plugin/preset detected."

The plugin that fails is @babel/plugin-transform-regenerator (no marginal plugin, 1.6 milion downloads / week). This is my entire .babelrc: { "presets": [], "plugins": [ ...

Babel error: "Error: Cannot find module 'babel-plugin-transform-object-rest-spread' from '/vagrant'"

I'm trying to upgrade from Babel 6 -> 7. I used npx babel-upgrade --write to assist with updating the package.json and then ran a npm install. When trying to run our webpack dev server, it fails...

BABEL parse error: transpiling react js into js

I'm trying to transpile my react jsx code into js using babel. This is the command I used: npx babel BlueSlide/js/student_slider.jsx --watch --out-file...

How to configure @babel/plugin-proposal-class-properties in webpack.config.js?

I am seeing @babel/plugin-proposal-class-properties as recommended alternative to using babel-preset-stage-0. In my current react app, I use webpack.config.js instead of babel.rc or any thing...

How to allow async functions in React + Babel?

I have a Typescript/React app, that can perform async function with a then/catch promise, but not with async/await/try/catch. The error is: Uncaught ReferenceError: regeneratorRuntime is not...

Jest Testing React Native cannot use import statement outside of a module

I have been trying to find out how to fix the following error when trying to run my Jest test using React Native: FAIL tests/App-test.js ● Test suite failed to...

Svelte Component Testing with Jest, Unable to load Svelte files recursively

I am working on a Svelte Project with Typescript and want to use Jest to test UI components using the @testing-library/svelte module . I am not able to properly import all my svelte files like my...

Declaring babel plugins for @babel/eslint-parser in .eslintrc

I've been trying for a while now to get @babel/plugin-proposal-class-properties plugin to work nicely with @babel/eslint-parser and eslint without success. This is my .eslintrc.js: ... "parser":...

SCRIPT5022: Exception thrown and not caught

I am using Vuejs for my web project. As there are some users out there who are still using IE11, I need to make this web project compatible. Currently I am getting this error on IE11: SCRIPT5022:...

Unknown Option error from Babel in React-Native app

I am building a react-native app with typescript in order to learn react native. Once I run the app with expo start and try to run on emulator I get this error: index.js: [BABEL]...

How to Use `import.meta` When Testing With Jest

I am writing Node.js code (in TypeScript) using ESModules and I need access to __dirname. In order to access the ESM equivalent of __dirname in CommonJS, I call...

Is it normal to have thousands of files in the node_modules/.cache/babel-loader folder?

I'm developing a react app, and I noticed over 11,000 JSON files in the client/node_modules/.cache/babel-loader folder. Is that to be expected, or is there a way to clear some of the old files?

Babel can't resolve imports in it its own source code

I have upgraded a React project to Webpack 5. The aliases are resolved by Babel. Everything was working fine with Webpack 4. But when launching webpack dev server, Babel makes the build crash...

Why nodemon fail when using -- exec babel-node?

I have installed the bable-cli and the babel-preset-env, after installing nodemon the npm start fail to load my application when using the following in the package.json file: "scripts": { ...

Parsing error : Cannot find module 'next/babel'

I have been encountering this error on every single new Next.js project that I create. The page can be compiled without any problem, it just keeps on showing as error on the first line in every js...

You attempted to import /babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/objectSpread2 which falls outside of the project src/ dir

I'm facing an issue in my React project, It works on Windows, but it does'nt work on my Ubuntu laptop. The error occurs when I'm performing the npm start. I have the error below for every redux...

How to configure Why Did You Render with NextJS 12

Next.JS uses babel to configure the Why Did You Render. module.exports = function (api) { const isServer = api.caller((caller) => caller?.isServer) const isCallerDevelopment =...

next failed to load SWC binary

When trying to run the command using nextjs npm run dev shows error - failed to load SWC binary see more info here: https://nextjs.org/docs/messages/failed-loading-swc I've tried uninstalling node...

Migrating from Babel to SWC with React

TL;DR How to translate a node script like this: "test": "NODE_ENV=test riteway -r @babel/register 'src/**/*.test.js' | tap-nirvana", to use SWC instead of Babel? Context We recently upgraded our...

Expo SDK 44 upgrade ERROR - App.js: [BABEL]: Unexpected token '.'

I have recently upgraded my app from SDK 40 to SDK 44 and came across this error App.js: [BABEL]: Unexpected token '.' (While processing:...

Webpack (in prod) bundles give error: TypeError: (0 , tm.useEffect) is not a function...why?

My React app is using Webpack + Babel. When I compile in development everything works perfectly well. When I bundle for production ("npm run build") and upload the bundle in prod, an error appear...

You may need an additional loader to handle the result of these loaders (upgrading Monaco Editor)

I wanted to upgrade the version of Monaco Editor to v0.31.1. I did npm install [email protected], and the recompilation gave me the following error: Failed to...

Force Webpack to use ES6 syntax in react-app bundle

My aim would be to have ES6 syntax (or latest one) in my entire react-app built. I've already managed to avoid polyfills in my own code by omitting some babel dependencies (such as...

com.facebook.react.common.javascriptexception : unexpected token ‘export’

i am using React Native 0.59.3 after i install package react-native-background-timer it given me error like that. com.facebook.react.common.JavascriptException : Unexpected token...