Questions tagged [babel-loader]
718 questions
9
votes
5 answers
Create React App with TypeScript and NPM Link: Enums causing Module parse failed
I have a basic create-react-app TypeScript project (client). Just directory up, I have a server and a shared folder. Inside the shared folder I have a number of interfaces and enums that I share between the server and the client.
I wish to link this…

foxtrotuniform6969
- 3,527
- 7
- 28
- 54
9
votes
1 answer
Can I use a webpack hook to modify file output just before it gets saved?
I want to manipulate a file after it has been processed by webpack and babel. There's an emit hook that is triggered just before a new file is saved, but I couldn't see a way to manipulate the file contents. So I settled for using the afterEmit hook…

kshetline
- 12,547
- 4
- 37
- 73
9
votes
1 answer
Webpack - TypeError: $ is not a function
i am new to webpack and i am creating a react application using webpack. I am getting this error while compiling TypeError: $ is not a function.
I am not using jquery but my node modules include some third party libraries.
I was only able to find…

PR7
- 1,524
- 1
- 13
- 24
9
votes
1 answer
How to fix ' Support for the experimental syntax 'exportDefaultFrom' isn't currently enabled' in node
I have a full stack javascript application running on React, Node, express.
The problem is export without default is not working in node, However, It is working fine in react.
Both my node and react share the same babel configs and packages.
I've…

Waeez
- 289
- 4
- 12
- 29
9
votes
1 answer
Babel 7 - Decorators transform doesn't work with babel-loader
I have a problem with decorators in React with mobX app. And it works ok with .babelrc, but I also have babel-loader with webpack. I copy babel config to webpack config, but it doesn't work. I checked all solutions that I can found in google, but…

zishe
- 10,665
- 12
- 64
- 103
9
votes
1 answer
How to compile ES6+ code to ES6 with webpack?
I want to compile my code to ES6 not ES5.
Here is my babelrc.
{
"presets": [
[
"env",
{
"modules": false,
"useBuiltIns": true,
"targets": {
"browsers": ["Chrome >= 60"]
…

Zhendong
- 99
- 6
9
votes
1 answer
Can Webpack tree-shaking remove unused babel-polyfills?
I try to make webpack tree-shaking remove unused babel-polyfill.
index.js file contains:
import 'babel-polyfill'
const add4 = n => n + 4
const add5 = n => n + 5
add4(6)
console.log('boom', add4(4))
In this file no code require any es2015+…

François Romain
- 13,617
- 17
- 89
- 123
8
votes
1 answer
import SVG as React Components with webpack 5
I want to use SVG as a React Component in my app.
I'm using: react 17.0.2, Webpack 5.57.1, @svgr/webpack 6.2.1.
I followed the steps on adding svgr in webpack.config file as in svgr documents svgr-doc but there is an Error in the console dev…

avivl
- 113
- 1
- 4
8
votes
1 answer
react-scripts parent folder node_modules error when running in child location
When running react-scripts build (Create-React-App) in a sub folder (c:\Repos\web_app1\api_ui) with it's own package.json, node_modules folder, etc. I get the following error:
react-scripts build
There might be a problem with the project…

Griffin Pair
- 105
- 6
8
votes
1 answer
vuejs + babel-loader this.setDynamic is not a function
I have some problems with my code. I'm trying to add babel-loader to my laravel-mix webpack's config, but I get an error telling me that this.setDynamic is not a function.
This is my webapack-mix.js file
const {mix} = require('laravel-mix');
const…

Aboubacar Ouattara
- 511
- 1
- 6
- 18
8
votes
1 answer
How to properly override babel@7 plugins for separate webpack server/client configurations
I'm using a single .babelrc config and using it in webpack.config.client.js and webpack.config.server.js with babel-loader.
.babelrc:
{
"presets": [
[
"@babel/preset-env",
{
"useBuiltIns": "usage",
"debug": false,
…

yotke
- 1,170
- 2
- 12
- 26
8
votes
3 answers
Incompatible babel-loader and babel-core versions
I installed babel-core, babel-loader, and a few other packages via npm
npm install babel-loader babel-core ...
This resulted in the following definitions in my package.json
"dependencies": {
"babel-core": "^6.26.3",
"babel-loader": "^8.0.0",
…

user2490003
- 10,706
- 17
- 79
- 155
8
votes
0 answers
How to exclude node_modules from another project, while still using JS components from there
UPDATE: I cannot reproduce the problem anymore for some reason, but cannot close the question. Leaving updated config details for others.
I have 2 projects, one for React Native, the other for React.
A source file from React Web Project ( say…

V P
- 845
- 10
- 28
7
votes
2 answers
webpack + babel - transpile object arrow functions doesn't work
I'm trying to configure webpack (5) with babel, using babel-loader to transpile to ES5.
Unfortunately, the output is not consistent. Basically, it's divided into two parts:
Some polyfills:
My code:
As you can see, the first part contains arrow…

RonZ
- 743
- 1
- 11
- 31
7
votes
1 answer
How to exclude core-js using useBuiltIns: "usage"
Using babel 7.5.5, core-js 3.1.4 and webpack 4.38.0, how can I exclude core-js from transpiling?
I do not want to exclude node_modules altogether since I have libs that need transpiling
If I use exclude: /node_modules\/(core-js)/, a core-js module…

Tom M
- 2,815
- 2
- 20
- 47