Questions tagged [babel-loader]

718 questions
0
votes
2 answers

Webpack throws 'Illegal import declaration', suspected config error

I have am attempting to compile my Javascript (es6) for use server side, the environment I'm targeting involves: node 8.9.1 npm 6.0.0 webpack 4.8.1 The first part of the code I'm attempting to compile using webpack is the file index.js…
JSDevGuy
  • 127
  • 2
  • 11
0
votes
2 answers

Babel 7 this becomes _this angularjs

I'm making an application using ES6, AngularJS and babel-loader 7.1.4, Webpack 3 . Everything worked fine until I created a service file: This is my service: 'use strict'; module.exports = (ngModule) => { ngModule.service('$ui', () => { …
Redplane
  • 2,971
  • 4
  • 30
  • 59
0
votes
1 answer

WebPack Babel ignore node_modules with exceptions

I have a node_module that is written in ES6 so causes issues when trying to view this in IE11. To solve this I setup babel so which solves the issue with IE11. But, babel seems to be trying to parse ALL node modules rather than just the one I want…
Chris
  • 26,744
  • 48
  • 193
  • 345
0
votes
1 answer

Babel not transpiling `class` in *.mjs files

Given import test from './test.js'; import test2 from './test.mjs'; and test.js and test.mjs both containing class A { test() { console.log('from mjs'); // or console.log('from js'); } } export default A; Babel transpiles …
David Mulder
  • 26,123
  • 9
  • 51
  • 114
0
votes
1 answer

babel-loader only for transpiling es6 to es5?

I use babel-loader together with Webpack to transpile JavaScript es6 to es5. Is it though possible to do the opposite? Transpile everything to es6? If not, is there another proven Webpack loader (for development or production) for that? Versions I…
Socrates
  • 8,724
  • 25
  • 66
  • 113
0
votes
1 answer

Unable to load stage-3 javascript file using babel-loader from webpack

Overview Following the Auth0 documentation, they have a JavaScript file that has field variables (stage-3). When running my app, I get the following error: ERROR in ./src/auth/AuthService.js Module parse failed: Unexpected token (7:16) You may need…
homersimpson
  • 4,124
  • 4
  • 29
  • 39
0
votes
0 answers

Webpack: ReferenceError: requrie is not defined

I am trying to set up a simple react project with webpack and babel here. Ran into problem when I first build. webpack.config.js const webpack = require('webpack'); const path = requrie('path'); module.exports = { entry: { app:…
user2526586
  • 972
  • 2
  • 12
  • 27
0
votes
2 answers

Webpack doesn't work (bundle.js)

I'm trying to generate bundle.js but webpack doesn't work. Here's the error I've got: C:\Users\myname\Documents\lynda\ECMAScript6\Ch02\02_02\youtube2>webpack Invalid configuration object. Webpack has been initialised using a configuration object…
kayak
  • 440
  • 3
  • 7
  • 19
0
votes
2 answers

How to properly configure react with webpack-4 in development mode

I am getting an error code that is auto-generated when I use webpack and babel in a NodeJs React application: Uncaught ReferenceError: Invalid left-hand side in assignment Here is the offending line in the code auto-generated by…
ccalvert
  • 3,816
  • 1
  • 23
  • 22
0
votes
1 answer

npm package in ES6 not getting bundled in webpack

In my project package.json (listed only babel related packages): "@babel/core": "7.0.0-beta.37", "@babel/plugin-syntax-dynamic-import": "7.0.0-beta.37", "@babel/register": "7.0.0-beta.37", "babel-eslint":…
Valay
  • 1,991
  • 2
  • 43
  • 98
0
votes
1 answer

Babel Type for 'module.exports'

Im writing a function that uses babel.transform to detect exported modules such as default & named exports. For the default and named exports I am using the following babel types for detection: ExportDefaultDeclaration ExportNamedDeclaration But…
ChoclateLove
  • 672
  • 1
  • 6
  • 11
0
votes
0 answers

How can I use ES6 modules to import momentjs and make babel-loader transpile it to es5?

In my webpack.conf.js I set babel-loader like this { test: /\.js$/, loader: 'babel-loader', include: [resolve('src'), resolve('test'),resolve('node_modules/moment')], options: { presets: [['es2015', { modules: false }]], …
Qiulang
  • 10,295
  • 11
  • 80
  • 129
0
votes
1 answer

Babel loader not loading form config.json file

I am a beginner in using Reactjs and I get the following error when I run the webpack: ERROR in ./src/client/app/index.jsx Module parse failed: Unexpected token (6:11) You may need an appropriate loader to handle this file type. Code: class App…
0
votes
1 answer

[Vue warn]: Cannot find element: #app Express

On fresh project my app doesn't found the root element withe VueJS (2.5.13) on expressJs server. my index.html: Test
darkiron
  • 1,174
  • 1
  • 10
  • 20