babeljs

transpiler battle: breaking out of nested function, with vs without throw

若如初见. 提交于 2020-08-26 13:54:08
问题 I have just finished writing "version 0" of my first (toy) transpiler. It works. It turns a string of "pseudo JavaScript" (JavaScript with an additional feature) into a string of runnable JavaScript. Now, I want to improve it. The work area possibly most interesting for other SO users is this: The compiled code (i.e., output of my transpiler) does not heed a coding style recommendation as given in an accepted answer to some earlier SO question. If I would have at my hands a second transpiler

transpiler battle: breaking out of nested function, with vs without throw

橙三吉。 提交于 2020-08-26 13:54:05
问题 I have just finished writing "version 0" of my first (toy) transpiler. It works. It turns a string of "pseudo JavaScript" (JavaScript with an additional feature) into a string of runnable JavaScript. Now, I want to improve it. The work area possibly most interesting for other SO users is this: The compiled code (i.e., output of my transpiler) does not heed a coding style recommendation as given in an accepted answer to some earlier SO question. If I would have at my hands a second transpiler

NodeJS [DEP0097] DeprecationWarning:

吃可爱长大的小学妹 提交于 2020-08-22 11:55:53
问题 Can you help me with this error? (node:6692) [DEP0097] DeprecationWarning: Using a domain property in MakeCallback is deprecated. Use the async_context v ariant of MakeCallback or the AsyncResource class instead. Unhandled rejection Error in plugin "webpack-stream" the codeis import gulp from 'gulp'; import yargs from 'yargs'; import sass from 'gulp-sass'; import cleanCSS from 'gulp-clean-css'; import gulpif from 'gulp-if'; import sourcemaps from 'gulp-sourcemaps'; import imagemin from 'gulp

Eslint rule for optional chaining & nullish coalescing operator

余生颓废 提交于 2020-08-21 08:59:07
问题 I am looking for the relevant eslint rules for @babel/plugin-proposal-optional-chaining @babel/plugin-proposal-nullish-coalescing-operator My editor highlights in red when I do the following const baz = obj?.foo?.bar?.baz; // 42 const safe = obj?.qux?.baz; // undefined const foo = obj.baz ?? 'default'; // default // eslint-disable-next-line no-console console.log('baz', baz); // eslint-disable-next-line no-console console.log('safe', safe); // eslint-disable-next-line no-console console.log(

Transpiling ES6 for IE11 with Babel

怎甘沉沦 提交于 2020-08-05 20:28:34
问题 I'm new to babel and trying to transpile my es6 code to work with IE11. But when I run the code in IE11 I get js errors about my forEach code. From what I've read I needed to add the preset @babel/preset-env . I added that to my config file so I'm not sure why it's not transpiling those forEach calls. const path = require('path'); module.exports = { entry: { setupForm: "./Scripts/es6/setupForm.js", prelimForm: "./Scripts/es6/prelimForm.js" }, output: { filename: '[name].js', path: path

Transpiling ES6 for IE11 with Babel

℡╲_俬逩灬. 提交于 2020-08-05 20:28:07
问题 I'm new to babel and trying to transpile my es6 code to work with IE11. But when I run the code in IE11 I get js errors about my forEach code. From what I've read I needed to add the preset @babel/preset-env . I added that to my config file so I'm not sure why it's not transpiling those forEach calls. const path = require('path'); module.exports = { entry: { setupForm: "./Scripts/es6/setupForm.js", prelimForm: "./Scripts/es6/prelimForm.js" }, output: { filename: '[name].js', path: path

@babel/plugin-proposal-class-properties not being picked up when compiling

我只是一个虾纸丫 提交于 2020-07-23 07:21:09
问题 I am trying to incorporate React Native Calendars into my React webapp. I have run npm install --save react-native-calendars and then added the Calendar component to a page (this is then rendered by App.js ) import React from 'react'; import {Calendar} from 'react-native-calendars'; class CalendarPage extends React.Component{ render(){ return ( <div> <h1>This is the calendar</h1> <Calendar /> </div> ) } } export default CalendarPage; When I run npm start (or save the file when the server is

@babel/plugin-proposal-class-properties not being picked up when compiling

你离开我真会死。 提交于 2020-07-23 07:20:34
问题 I am trying to incorporate React Native Calendars into my React webapp. I have run npm install --save react-native-calendars and then added the Calendar component to a page (this is then rendered by App.js ) import React from 'react'; import {Calendar} from 'react-native-calendars'; class CalendarPage extends React.Component{ render(){ return ( <div> <h1>This is the calendar</h1> <Calendar /> </div> ) } } export default CalendarPage; When I run npm start (or save the file when the server is