babel

How to transpile node_modules folder using just babel 7?

99封情书 提交于 2020-06-12 06:36:27
问题 Trying to unit test reactjs application using mocha but getting error from es6 features (import/export) used inside node_modules folder. The application in question is transpiled using babel but since one of react component is using a module from node_modules its throwing error Syntax Error:Unexpected token export . I am aware that babel ignores node_modules folder by default, but not sure how to approach this. Any help would be appreciated. Thanks. Test Command :- "test": "SET NODE_ENV=test&

Requires Babel “^7.0.0-0”, but was loaded with “6.26.0”

允我心安 提交于 2020-06-11 17:07:05
问题 I have migrated my app to babel 7 beta and everything seems to work except the tests. I think I've read everything out there but I'm still getting this error: ● Test suite failed to run Requires Babel "^7.0.0-0", but was loaded with "6.26.0". If you are sure you have a compatible version of @babel/core, it is likely that something in your build process is loading the wrong version. Inspect the stack trace of this error to look for the first entry that doesn't mention "@babel/core" or "babel

Requires Babel “^7.0.0-0”, but was loaded with “6.26.0”

て烟熏妆下的殇ゞ 提交于 2020-06-11 17:05:33
问题 I have migrated my app to babel 7 beta and everything seems to work except the tests. I think I've read everything out there but I'm still getting this error: ● Test suite failed to run Requires Babel "^7.0.0-0", but was loaded with "6.26.0". If you are sure you have a compatible version of @babel/core, it is likely that something in your build process is loading the wrong version. Inspect the stack trace of this error to look for the first entry that doesn't mention "@babel/core" or "babel

Babel 7 doesn't change CONST to VAR

a 夏天 提交于 2020-06-10 08:45:04
问题 I have problem with Safari version <= 9. Babel doesn't seem to replace const with var. I get this error in console: Unexpected keyword 'const'. Const declarations are not supported in strict mode. I tried using @babel/preset-stage-0 but babel removed it. This is my app configuration: .babelrc { "presets": [ "@babel/preset-env", "@babel/preset-react" ], "plugins": [ "@babel/plugin-transform-object-assign" ] } webpack.config.js const path = require("path"); const webpack = require("webpack");

Babel 7 doesn't change CONST to VAR

馋奶兔 提交于 2020-06-10 08:44:10
问题 I have problem with Safari version <= 9. Babel doesn't seem to replace const with var. I get this error in console: Unexpected keyword 'const'. Const declarations are not supported in strict mode. I tried using @babel/preset-stage-0 but babel removed it. This is my app configuration: .babelrc { "presets": [ "@babel/preset-env", "@babel/preset-react" ], "plugins": [ "@babel/plugin-transform-object-assign" ] } webpack.config.js const path = require("path"); const webpack = require("webpack");

Is there a way to setup webpack config to load specific core-js entries

好久不见. 提交于 2020-06-08 19:28:40
问题 DISCLAIMER: I'm not terribly familiar with webpack or babel outside of simple setup, so if the question isn't clear then I apologize and will do my best to offer further clarity. So, the situation currently is that a coworker updated a bunch of packages recently, babel among them, and babel is no longer transpiling the code properly for .forEach and spread operators in ie11 (specifically when iterating over a node list). The resulting behavior is a bit frustrating; simply put, nothing happens

Core-JS 3 Babel results in mini-css-extract-plugin error

笑着哭i 提交于 2020-05-17 07:09:06
问题 Following on from this question I have set up my Webpack 4 config to handle babel-loader like this { module : { rules : [{ test : /\.js$/, // Some module should not be transpiled by Babel // See https://github.com/zloirock/core-js/issues/743#issuecomment-572074215 exclude: ['/node_modules/', /\bcore-js\b/, /\bwebpack\/buildin\b/, /@babel\/runtime-corejs3/], loader : "babel-loader", options : { babelrc : false, // Fixes "TypeError: __webpack_require__(...) is not a function" // https://github

Babel-loader requires babel-core instead of @babel/core

霸气de小男生 提交于 2020-05-15 10:03:11
问题 I replaced babel-core with @babel/core while babel-loader expects babel-core : { "name": "myproject-ui", "version": "1.0.0", "description": "User interface for myproject", "main": "index.js", "scripts": { "start": "npx webpack-dev-server", "build": "npx webpack", "test": "echo \"Error: no test specified\" && exit 1" }, "author": "Hello", "license": "ISC", "devDependencies": { "@babel/core": "^7.0.0-rc.2", "@babel/plugin-proposal-object-rest-spread": "^7.0.0-rc.2", "@babel/preset-env": "^7.0.0

Jest tests on React components: Unexpected token “<”

这一生的挚爱 提交于 2020-05-15 05:27:40
问题 Trying to set up Jest to test my React components (Technically I'm using Preact) but same idea... Anytime I try to get a coverage report, I get errors when it hits any jsx syntax. Error Running coverage on untested files...Failed to collect coverage from /index.js ERROR: /index.js: Unexpected token (52:2) 50 | 51 | render( > 52 | <Gallery images={images} />, | ^ I've tried following the docs and similar issues but no luck! It seems as though my babel settings aren't getting used by Jest. Any

Jest tests on React components: Unexpected token “<”

放肆的年华 提交于 2020-05-15 05:27:27
问题 Trying to set up Jest to test my React components (Technically I'm using Preact) but same idea... Anytime I try to get a coverage report, I get errors when it hits any jsx syntax. Error Running coverage on untested files...Failed to collect coverage from /index.js ERROR: /index.js: Unexpected token (52:2) 50 | 51 | render( > 52 | <Gallery images={images} />, | ^ I've tried following the docs and similar issues but no luck! It seems as though my babel settings aren't getting used by Jest. Any