Questions tagged [babel-loader]
718 questions
5
votes
1 answer
Module build failed (from ./node_modules/babel-loader/lib/index.js): Error: Cannot find module './src/data'
I'm getting this error when I try to run my app, I'm using all the same dependencies that I always use so I'm very baffled by this. I've tried deleting my package-lock.json and node modules a couple of times and tried searching the whole repo for…

Maeve Griffin
- 51
- 1
5
votes
1 answer
Babel Webpack Error: You may need an appropriate loader to handle this file type
I am trying to lazy load some React components like so:
node: v10.15.2
const Library = React.lazy(() => import('./components/Library'))`
My error:
Module parse failed: Unexpected token (51:9)
You may need an appropriate loader to handle this file…

Karl Taylor
- 4,839
- 3
- 34
- 62
5
votes
0 answers
React syntax error while compiling component from node_modules
I have below structure and its compiling good.
Project
Zoo
Src
Components
MySharedComponents
When i try to move my shared components as one Project and try to install it in other project like below structure. This gives compilation…

Andi AR
- 2,678
- 2
- 23
- 28
5
votes
1 answer
Latest Babel (@babel/core v7) error "exports is not defined"
I've tried everything i could find so far and i'm still getting the error "exports is not defined".
I am using ReactJS.NET (for NetCore2) and it is mandatory otherwise my entire app will not load under NetCore2.
This is my .babelrc
{
"presets": [
…

Dante R.
- 902
- 3
- 13
- 41
5
votes
1 answer
Webpack 4 + Babel 7 transform-runtime - Invalid configuration object
I'm currently using webpack 4 with babel 7 which was just released not long ago. Whenever I'm trying to run the latest webpack with babel on my project, I'm getting the following error currently with the plugin…

cellsheet
- 476
- 1
- 4
- 22
5
votes
1 answer
Output of babel : remove arrow functions in a node module
I have an issue with my generated webpack bundle on IE11.
I have check the bundle and it is due to some arrow functions.
It come from a node_module package : lite-id
My webpack config :
var config = {
devtool: 'source-map',
entry:…

k4st0r42
- 1,174
- 1
- 15
- 29
5
votes
0 answers
Prevent Babel-loader/webpack to transpile es6-modules to es5
module.exports = {
bail: true,
watch: true,
target: 'web',
entry: paths.allLibraryIndexJs,
output: {
path: paths.appLibraryBuild,
filename: '[name].app.js',
library: '[name]',
libraryTarget: 'umd',
…

DrEarnest
- 853
- 2
- 13
- 27
5
votes
1 answer
Babel + WebPack: class properties can't be compiled
I'm working on simple js app and I ran into a problem related to babel or/and webpack - class (static) properties couldn't be compiled, an error is thrown:
ERROR in ./components/comp1.js
Module parse failed: Unexpected token (2:18)
You may need an…

user1820686
- 2,008
- 5
- 25
- 44
5
votes
1 answer
Do I need babel-loader on top of tsloader to transpile typescript with webpack?
I am writing webpack.config.js to transpile typescript (to be more precise tsx) into ES5 using tsloader and babel-loader.
I have two questions:
1) Do we still need babel-loader even though tsloader output ES5 files?
2) Does it make sense to set…

hitochan
- 1,028
- 18
- 34
5
votes
3 answers
Failed to load external module @babel/register while gulp
In my react project everything works fine on my vmware. But when I cloned the same app and ran gulp command I am getting this error during compilation saying
MacBook-Pro:Frontend1.0 apurvgandhwani$ gulp
[18:42:31] Failed to load external module…

EdG
- 2,243
- 6
- 48
- 103
5
votes
2 answers
ERROR in ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/selector.js?type=script&index=0!./src/components/table.vue
I am getting error while loading vue components from same folder in vuejs.I have imported correctly. But while building ,it shows the below error.
ERROR in…

Reshma Ks
- 81
- 1
- 1
- 7
5
votes
3 answers
Is there a way to preserve license comments?
I'm using babel-loader in my webpack.config.js file but I noticed it removes the license comments of the form:
/*! whatever **/
Is there a way to preserve them?
I noticed babel has a commentsoptions, but I guess that would preserve any comment and…

Alvaro
- 40,778
- 30
- 164
- 336
5
votes
0 answers
Babel does not find a plugin
I have an app module and common module that is shared by several app modules.
- app
- src
- package.json
- webpack.config.json
- .babelrc
- common
- lib
- package.json
- .babelrc
app/package.json
dependencies: {
common:…

T. Vojtech
- 51
- 1
- 4
4
votes
0 answers
Nuxt 2 optional chaining is not working for template as well as in code
I recently tried to upgrade my node version as nodev10 stopped support,
I had vue-template-babel-compiler installed to support optional chaining for the templates but after doing a fresh npm install, somehow I started getting Server compilation…

Bravo
- 61
- 2
- 7
- 26
4
votes
0 answers
React 17 ESbuild - Problem with @emotion/react, export 'useInsertionEffect' (imported as 'React') was not found in 'react'
how are you?
I have a project with React 17 and babel-loader and i'm trying to change it to esbuild-loader. For this i installed "esbuild-loader": "2.19.0" and changed my webpack loader config to this:
{
test: /\.js$/,
loader: 'esbuild-loader',
…

Rohr Facu
- 607
- 1
- 12
- 29