I am using the optional chaining operator in my application, for instance: (checks if optionalField exists, then do something with it) The above code works perfectly on my machine but it gives me an error when I try to build this code on Heroku. Here is what the logs say: Does anyone know why is that? I suspe…
Tag: babeljs
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 defined . The error seems to come from Babel. Here is my config: How to fix this? Answer You can find your solution at …
Webpack resolve alias and compile file under that alias
I have project which uses lerna ( monorepo, multiple packages ). Few of the packages are standalone apps. What I want to achieve is having aliases on few of the packages to have something like dependency injection. So for example I have alias @package1/backendProvider/useCheckout and in webpack in my standalo…
How to set env in package.json which is used within .bablerc
I am trying to run Jest tests as part of a script before I then run webpack, like this. Jest only works with compiled code, so I had set my .babelrc to the following, which worked, however then it transpiled all my code in webpack which I didn’t want, in development mode I want to leave the JavaScript u…
Ignore return outside of function with babel 7
I recently updated to babel 7 and webpack 4 and am receiving this error when running our gulp build task: This is caused by the return outside of a function in browser-syncs dev-ip dependency. Is there a way to configure my .babelrc file to ignore this? I’ve tried the following: Installing only producti…
Babel and Webpack are throwing “Can’t resolve ‘regenerator-runtime/runtime'”
I’m working on a browser-based project that needs to be IE11-compatible (sigh). Webpack is choking on async/await. Here is my console’s output: I’ve looked at many SO questions similar to mine, without luck. Many recommend using @babel/polyfill which I am avoiding since it has been deprecate…
Webpack.config.js: Configuration has an unknown property ‘default’
I’ve moved everything over from a working project (ultimate-hot-reloading-example), to an existing project of mine that uses the keystone cms. I uninstalled ALL dev dependencies in my project, and installed all of the exact dependencies in the working project into mine (webpack, babel, etc…). For …
Why is Babel 7 not compiling node_modules files?
I have error in IE11 SCRIPT1002: Syntax error (problem with class syntax). My simple code with 2 lines: I wan’t that my babel7 compile class into ES5 code I have tried write .babelrc file : and https://babeljs.io/docs/en/babel-plugin-transform-classes haven’t fixed too Update : I have tried use @b…
How to import from React-Select CDN with React and Babel?
I’ve created a react application following the steps on the React Website, but I’m having issues utilizing the React-Select Library (particularly the Select Component). I can only use cdn files to load dependencies, including the React-Select cdn file located on cdnjs I’m getting the followi…
React –> Warning: validateDOMNesting(…): cannot appear as a descendant of
I’m getting this warning in browser console: on line: It’s a react project. Also I’m using webpack. How to solve this problem? Answer The warning tells you what exactly you need to do. You cannot nest <p> tags and hence use div for the outer tag like