babel-loader

Webpack with babel-loader not emitting valid es5

被刻印的时光 ゝ 提交于 2019-12-23 05:43:05
问题 I have a webpack config that is based off https://github.com/vuejs-templates/webpack-simple/blob/master/template/webpack.config.js It uses vue-loader and babel-loader. The issue is I cannot get it to generate ES5 code so that it will work in the most broad range of clients. If I use the ES2015 preset, webpack.optimize.UglifyJsPlugin fails to minify the output because Uglify can only handle ES5 (not counting the harmony branch). The errors are similar to: Unexpected token: punc (() and occur

Module build failed (from ./node_modules/babel-loader/lib/index.js): TypeError: Cannot read property 'bindings' of null

六眼飞鱼酱① 提交于 2019-12-20 18:29:40
问题 I've got an error while building a project: Module build failed (from ./node_modules/babel-loader/lib/index.js): TypeError: Cannot read property 'bindings' of null My development environment is as follows: Node: 8.0.0 npm: 5.0.0 devDependencies "devDependencies": { "babel-core": "^6.26.3", "babel-loader": "^8.0.0", "babel-preset-env": "^1.7.0", "webpack": "^4.17.1", "webpack-dev-server": "^3.1.7" } 回答1: babel-loader@8.x uses Babel 7.x, which is @babel/core@^7.0.0 , and more importantly in

How to upgrade to babel 7

落爺英雄遲暮 提交于 2019-12-19 17:32:53
问题 I tried to upgrade Webpack and babel to 4, 7 respectively but couldn’t make it work. Also the official doc isn’t helping much with the upgrade I am getting following issue compiler error: ERROR in Cannot find module '@babel/core' @ multi main dependencies I am using: "babel-core": "^6.26.3", "babel-eslint": "^9.0.0", "babel-loader": "^8.0.0", "babel-plugin-transform-class-properties": "^6.24.1", "babel-plugin-transform-object-rest-spread": "^6.26.0", "babel-polyfill": "^6.26.0", "babel-preset

Whats the difference when configuring webpack babel-loader vs configuring it within package.json?

ぐ巨炮叔叔 提交于 2019-12-18 06:06:28
问题 Hi please help me understand the differences between setting babel config inside .babelrc vs webpack loader options, vs inserting it in package.json. For example, Would it make any difference if I put the presets in the webpack babel-loader options vs package.json or a separate .babelrc config file? In webpack config: { test: /\.(js|jsx|mjs)$/, loader: require.resolve('babel-loader'), options: { "presets": [ "react-app" ] }, }, In package json: "babel": { "presets": [ "react-app" ] }, 回答1:

What is the difference between babel-core and @babel/core?

半腔热情 提交于 2019-12-13 12:23:46
问题 What is the difference between babel-core and @babel/core ? Are they the same thing but different versions? If not so, when do you use one and when do you use the other? Thank you. 回答1: Since Babel 7 the Babel team switched to scoped packages, so you now have to use @babel/core instead of babel-core . But in essence, @babel/core is just a newer version of babel-core . This is done to make a better distinction which packages are official and which are third-party. 来源: https://stackoverflow.com

Uncaught Error: only one instance of babel-polyfill is allowed error on production

我们两清 提交于 2019-12-11 16:57:34
问题 I tried all the potential solutions but they did not work. What happens if I have babel-polyfill error on production. Some browsers do not work? 📷 I am currently using react-loadable to create chunks by page. After that I am getting babel-polyfill error. webpack.prod.js entry: ['babel-polyfill', path.resolve(CWD, './react/containers/root/root.prod.js')], .babelrc { "presets":[ "react", "es2015", "stage-2" ], "plugins":[ "react-loadable/babel", "syntax-dynamic-import", "dynamic-import-node", [

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

这一生的挚爱 提交于 2019-12-11 15:43:43
问题 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 an appropriate loader to handle this file type. | | export default class AuthService { | authenticated = this.isAuthenticated(); | authNotifier = new EventEmitter(); | Above, the unexpected token is the first = sign after authenticated . Diagnosing

Webpack babel-loader doesn't transpile imported .js files

倾然丶 夕夏残阳落幕 提交于 2019-12-11 12:46:05
问题 My VueJS app doesn't render correctly in IE11 (polyfills are being applied though). I discovered that this is caused by several JS files I imported into my project, which apparantly aren't transpiled by babel. And indeed, when I manually transpile these files (babel-cli) and import the transpiled version, the problem is resolved. However, these files should be transpiled by automatically, just like the rest of my project. How can I solve this issue? import example import depth from '@

Module build failed (from ./node_modules/babel-loader/lib/index.js): Error: Cannot find module './src/data'

*爱你&永不变心* 提交于 2019-12-10 15:55:33
问题 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 /src/data and found nothing. More of the error message: ERROR in ./src/index.js Module build failed (from ./node_modules/babel-loader/lib/index.js): Error: Cannot find module './src/data' and this is the ./src/index.js from the error import { render

vuejs + babel-loader this.setDynamic is not a function

时光毁灭记忆、已成空白 提交于 2019-12-10 15:02:58
问题 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 VueLoaderPlugin = require('vue-loader/lib/plugin') /* |-------------------------------------------------------------------------- | Mix Asset Management |-------------------------------------------------------------------------- | | Mix provides a