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
Tag: babeljs
Babel command line all jsx files in a directory, output as js files
I have been running a command to turn .jsx files into .js files one at a time: I want to do it for everything in a directory. I read through the help command’s options and it seems like I should be able to do this But that says it requires filenames, despite providing a directory. What’s the right syntax to
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
How do I persuade babel to let me define a Javascript array of consts?
I’m building my first expo/react app. I keep getting an “Unexpected token” error message in App.js: the error being in the [ of the line beginning const. As best I can tell, this is a babel issue: this syntax was introduced in ES2015. AFAICS, this should be resolvable by adding @babel/preset-env to babel.config.js thus: Bundling succeeds, but the error remains!
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
Getting compilation errors regarding loaders when running React app
Hi I’m having an issue when trying to run my react app. I’ve installed a couple of packages to from a tutorial using the ceramic and 3id networks. This error has only shown up recently and I’ve looked online but still not too sure what be causing the issue. The version of node I am using is v14.15.0, my npm
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,