Skip to content
Advertisement

Tag: babeljs

unable to use babel to run file

I’m trying to get more familiar with modern javascript and am following a tutorial. Early setup includes running a file from another file. I have a server.js file with a simple ‘import ‘./config’; command. As a test that repo setup is correct, I should be able to run ‘babel server.js’. But I keep returning the error shown below. How do

Babel 7.18 doesn’t transpile components outside the project root directory

I have a component sharedlib outside the babel root directory of project1. I used to use webpack to package this project without problems, but when I configured babel, I got the following error: The demo project to reproduce the problem is on github https://github.com/xybei/test_babel My project directory is like this: Here’s the project1/package.json, I have configured sharedlib as a local

Could not find/install babel plugin ‘proposal-decorators’ on CodeSandbox with Firebase

I’m trying to use Codesandbox in React project, but I’m stuck with error: Could not find/install babel plugin ‘proposal-decorators’: Cannot find plugin ‘proposal-decorators’ or ‘babel-plugin-proposal-decorators’. Error happens when I adding firebase utility in the project. On my local machine everythings fine. Here is my code: https://codesandbox.io/s/eloquent-sun-r1bcqv I tried to: Install babel/plugin-proposal-decorators and add “@babel/plugin-proposal-decorators”: “7.18.2” in dependencies of package.json Install

Instagram embed: React’s JSX doesn’t support namespace tags

I was trying to embed an Instagram post on my React website but I encountered the error “Namespace tags are not supported by default. React’s JSX doesn’t support namespace tags. You can set throwIfNamespace: false to bypass this warning.” Where am I supposed to set throwIfNamespace: false. My first guess is node_modules/react-scripts/webpack.config.js. Where in webpack.config am I supposed to put

MUI5 not working with jest – SyntaxError: Cannot use import statement outside a module

Reproducible repo: https://github.com/hutber/cannotusestatement What is more worrying is: https://codesandbox.io/s/vigilant-bartik-bmz8x in the sandbox the tests pass. However if you checkout the above repo, which was imported into this sandbox it will not pass locally. I have no doubt that the issue is my jest does not compile the node_modules that would be needed for running my tests. But I am at

Migrating from Babel to SWC with React

TL;DR How to translate a node script like this: to use SWC instead of Babel? Context We recently upgraded our Next.js version. Next.js now supports SWC instead of Babel. The unit tests for React in our project are written with RITEway. The test command is: It transforms the files with Babel first because otherwise import statements and JSX would cause

What is @babel/plugin-transform-classes?

I run Google PageSpeed Insights on my site, and it reports an issue that is “Avoid serving legacy JavaScript to modern browsers”, as below: I have no idea of what is @babel/plugin-transform-classes, so I search online and it seems babel is a JavaScript compiler and @babel/plugin-transform-classes is a plugin. But I don’t know or install the compiler and the plugin,

Advertisement