babeljs

How to use babel/corejs3/webpack correctly for IE11?

三世轮回 提交于 2020-12-05 07:20:37
问题 With my current config (see below), I'm getting this error: [object Error]{description: "Argument ob...", message: "Argument ob...", name: "TypeError", number: -2147418113, stack: "TypeError: ...", Symbol()_7.bs7gi3oa3wi: undefined} I tried to dig based on Symbol()_ ... : undefined} but I couldn't find any clear indication. This is my .babel.config.js : module.exports = function (api) { api.cache(true); const presets = [ [ '@babel/preset-env', { // modules: false, corejs:"3.6.4", useBuiltIns:

Correct way (if possible) to store JSX code into a Javascript variable

你。 提交于 2020-12-02 07:14:21
问题 I´ve written the following code using ReactJs´s JSX syntax: import { Link } from 'react-router'; class SidebarMenuItem extends React.Component { render() { var href = (this.props.submenu ? 'javascript:' : {<Link to="mod/admin" + this.props.link />}; return ( <a href={href} onClick={this.selected}> <i className={'fa ' + this.props.icon} /> <span>{this.props.title}</span> </a> ) } } But it seend that I cannot store a direct JSX code into a variable, as I got the following error: Module build

TypeScript & runtime type-checking, simple solution in 2020 [closed]

时光怂恿深爱的人放手 提交于 2020-11-27 04:55:53
问题 Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed last month . Improve this question As we all know, TypeScript type-checks only at compile-time. There are couple of existing approaches to add runtime checks, such as io-ts, but I'm left to wonder if there is a simpler way. For example a Babel plugin that would transpile this: type Todo = { userId:

webpack + babel - transpile object arrow functions doesn't work

核能气质少年 提交于 2020-11-25 03:43:31
问题 I'm trying to configure webpack (5) with babel, using babel-loader to transpile to ES5. Unfortunately, the output is not consistent. Basically, it's divided into two parts: Some polyfills: My code: As you can see, the first part contains arrow functions, and the second one not. I've tried to add @babel/plugin-proposal-class-properties and @babel/plugin-transform-arrow-functions to my .babelrc file, but the class-properties is missing (with debug enabled). I must admit, I'm not sure that the

webpack + babel - transpile object arrow functions doesn't work

梦想的初衷 提交于 2020-11-25 03:42:04
问题 I'm trying to configure webpack (5) with babel, using babel-loader to transpile to ES5. Unfortunately, the output is not consistent. Basically, it's divided into two parts: Some polyfills: My code: As you can see, the first part contains arrow functions, and the second one not. I've tried to add @babel/plugin-proposal-class-properties and @babel/plugin-transform-arrow-functions to my .babelrc file, but the class-properties is missing (with debug enabled). I must admit, I'm not sure that the