Questions tagged [babel-loader]

718 questions
6
votes
1 answer

How to fix: this.setDynamic is not a function

There is some problem with my babel config, not sure what it is.. Error I am seeing: ERROR Failed to compile with 1 errors friendly-errors 21:27:50 ERROR …
Joshua
  • 481
  • 6
  • 21
6
votes
1 answer

Measure Babel compilation performance (per file or module)

I'm trying to figure out how to extract some information from babel compilation process. More specifically, when I run babel (no matter if using Webpack's babel-loader, test frameworks' transformers, Babel's CLI, etc) I'd need to extract some…
Andrea Carraro
  • 9,731
  • 5
  • 33
  • 57
6
votes
1 answer

How can I use Webpack to create bundle for a Rest API Express NodeJS Server

Hope you are all well :) I was working on a REST API server with Nodejs and after completing an alpha version, I wanted to create a bundle for it with build tools, Although I succeeded at some point in bundling the app still could not make the…
6
votes
1 answer

How to optionally process code in node_modules with babel-loader in webpack?

This is a follow up from this answer. I have some 3rd party code (react components) that I bundle as ES modules (using the pkg.module entry point). This works great (you get module concatenation and tree shaking), but the included code isn't…
Dominic P
  • 2,284
  • 2
  • 27
  • 46
6
votes
3 answers

React Unexpected token < - babel loader

Hi i have problem with babel-loader it write me ERROR in ./src/js/pages/Admin/views/Pages/Register/Register.js Module build failed (from ./node_modules/babel-loader/lib/index.js): SyntaxError:…
d3tr1tus
  • 789
  • 2
  • 10
  • 23
6
votes
1 answer

How to use webpack with babel-loader and flow

I'm struggling with what I feel shouldn't be too hard of a setup. I want these three technologies to work together: webpack to bundle code babel so that I'm able to write modern JavaScript flow because type checking is helpful just like tests and…
Jakob Runge
  • 2,287
  • 7
  • 36
  • 47
6
votes
3 answers

babel-loader@7.1.2 requires a peer of webpack@2 || 3 but none was installed

I am having this issue while installing all node_modules. And this is making me crazy. babel-loader@7.1.2 requires a peer of webpack@2 || 3 but none was installed. Here is my package.json file { "name": "react-router-firebase-auth", …
Noman Ali
  • 3,160
  • 10
  • 43
  • 77
6
votes
1 answer

babel-preset-env SyntaxError: Unexpected token with spread properties

Why its not accepting spread properties ? I am using babel-preset-env for this. .babelrc { "presets": [ "react", [ "env", { "targets": {}, "debug": true, …
vijay
  • 10,276
  • 11
  • 64
  • 79
5
votes
1 answer

Babel config file in .mjs format does not work when using the function parameter api

I am looking into converting my current babel.config.js file to a babel.config.mjs file. This should be straight forward but for some reason I am getting the following error when I try to use the function parameter api in my configuration: Cannot…
sotiristherobot
  • 259
  • 3
  • 10
5
votes
1 answer

How to drop support for IE, and prevent babel transpilation to ES5 in order to gain performance gain

Currently I am using default webpack config of Create React App for babel transpilation. It seems that default babel-loader (in CRA config) uses "babel-preset-react-app". Now all I want is to prevent the transpilation of JS files to ES5 since I…
5
votes
1 answer

How to create IE11 Bundles with Webpack 5 and Babel 7

How can we compile modern JavaScript into backwards-compatible JavaScript bundles that can be used with Internet Explorer 11 (ie11)? Specifically, how can we do this with the latest versions of Webpack 5 and Babel 7?
anthumchris
  • 8,245
  • 2
  • 28
  • 53
5
votes
1 answer

create-react-app integrate with storybook 6.1.6 and build has error

create-react-app version react: v17.0.1 react-scripts: v4.0.1 storybook version @storybook/react: v6.1.6 @storybook/addon-docs: v6.1.6 @storybook/core: v6.1.6 and i could run yarn start to run react app and could run start-storybook -p 9009 -s…
5
votes
1 answer

Webpack and babel-loader not resolving `ts` and `tsx` modules

I'm having some trouble when trying to implement Typescript in my project. Using Webpack and Babel to transpile and bundle files Using babel-loader with @babel/preset-typescript Not using tsc These are my configs. webpack.dev.js const config = { …
cbdeveloper
  • 27,898
  • 37
  • 155
  • 336
5
votes
1 answer

How to correctly export SVGs in a React component library with TypeScript

I am in the process of extracting the core components of our React application into a separate component library for use in other client applications. These components use SVG icons, which already works in the original application by using…
TheKvist
  • 583
  • 5
  • 16
5
votes
1 answer

Why is my webpack bundle successfully built on host machine but is not in docker container?

I have a monorepo structure of my project like this: babel.config.js a-something b-something where I have the babel config file in the root of my project and the packages a-something and b-something. Inside package a-something I have the…
Yos
  • 1,276
  • 1
  • 20
  • 40