babel

vue-awesome-swiper兼容ie9

本小妞迷上赌 提交于 2019-12-05 15:13:15
轮播插件vue-awesome-swiper在ie9中运行的时候没效果 解决方法: vue-awesome-swiper在IE9下报错, 主要原因是element.classlist.add()方法在ie9中是不支持的。 解决方法是加个ployfill npm install classlist-polyfill --save npm install babel-polyfill --save 在webpack.base.conf.js中 加入classlist-polyfill 修改 module.exports entry 如下: module.exports = { // app: './src/main.js' entry: { app: ['classlist-polyfill', 'babel-polyfill', './src/main.js']} } 来源: https://www.jianshu.com/p/b578ab0cab7a 来源: https://www.cnblogs.com/baixinL/p/11930220.html

React: 认识React

流过昼夜 提交于 2019-12-05 11:33:47
一、简介 React-Native是Facebook开源的跨平台框架,用于实现前端和原生进行混合开发。React-Native开发可以很好的使用原生UI构建用户界面,与传统的使用WebView相比,不仅保留了原生的用户体验和流畅度,还提高了开发效率,React-Native的构建思路图如下。而React-Native是基于React设计的, 由此可见React在RN开发中是极其重要的。React的地址是Github地址: https://github.com/facebook/react 、官网地址: https://facebook.github.io/react/ 。接下来开始认识React。 二、基础 需要了解React的几个基本的特点,如下: 作为UI: React强调的是界面,只作为视图View在MVC中使用。 虚拟DOM:采用虚拟的节点,可以很好地优化视图的渲染和刷新(局部重绘),提高了性能。 数据流:单方向的数据流,比传统的数据绑定,更加灵活和快捷。 学习React需要掌握一些基本知识,如下: JSX语法知识:类似于XML语言,HTML是XML的子集,它跟HTML也很像。一种语法糖,更方便地创建虚拟DOM,需要解析器对它进行解析成JS。 ES6/7/8的知识: 遵循ECMAScript的JavaScript标准库,添加了许多新的语法特性,ES6解决了ES5的缺陷

Add babel polyfill to React Native Project

醉酒当歌 提交于 2019-12-05 11:01:46
I´m having a issue on android. Got this error: undefined is not a function(evaluating '_iterator2typeof Symbol==='function'?Symbol.iterator:'@@iterator'´) I think it is related to the use of for of, es6. Can i add babel-polyfill to React Native Project ? In order to add babel-polyfill to your react-native project after installing npm install --save babel-polyfill just import it like this in your entry endpoint : import 'babel-polyfill'; Now you can use new built-ins like Promise or WeakMap , static methods like Array.from and instance methods like Array.prototype.includes , etc. You can use

Error using ES7 async/await with node, webpack and babel-loader

老子叫甜甜 提交于 2019-12-05 10:22:16
I'm trying to use javascript ES7 syntax on the server using node.js with webpack and babel-loader (es2015 + stage-0 presets). I've gotten it to work with babel-node but when I run webpack I get the following error at the async keyword (9:22 is after the async keyword): ERROR in ./src/server.js Module parse failed: C:\dev\node-async-sample\src\server.js Unexpected token (9:22) You may need an appropriate loader to handle this file type. SyntaxError: Unexpected token (9:22) I've put the code on github at https://github.com/qubitron/node-async-sample , any ideas on how to get this to work? Here

How to disable babel transform-regenerator completely

梦想的初衷 提交于 2019-12-05 10:19:18
问题 I'm looking for a way to completely disable generator functions transform with babel. With babel 5 there was a blacklist option, but it seems that with babel 6 there is no way to do that (at least I did not find any documentation on the official website). My current configuration { "presets": [ "react", ], "plugins": [ "transform-object-rest-spread", ] } Disabling it like described here https://babeljs.io/docs/plugins/transform-regenerator/ did not help. Any ideas? 回答1: Have you tried

Fabric.js with Typescript and Webpack: Canvas is not a constructor

試著忘記壹切 提交于 2019-12-05 09:07:28
I'm trying to use fabric.js with Typescript and Webpack aside some other modules in a Laravel 5.4 application that work fine in the browser. @types/fabric ist installed and Typescript behaves correct. New to Typescript as well as Webpack i tried some variants with no success. The problem result.js:198 Uncaught TypeError: __WEBPACK_IMPORTED_MODULE_1_fabric___default.a.Canvas is not a constructor Variant A code.ts import fabric from "fabric"; const canvas = new fabric.Canvas('my-canvas'); result.js var canvas = new __WEBPACK_IMPORTED_MODULE_1_fabric__default.a.Canvas('my-canvas'); WEBPACK

VS Code Can't Set Breakpoints Properly

大憨熊 提交于 2019-12-05 08:57:14
I'm attempting to debug a tiny project but I'm unable to get the Debugger for Chrome extension to fully work. When I place a breakpoint it gets moved outside of the function I want to debug. I'm using webpack + babel. My project is being hosted on a .Net platform (specifically DNN). package.json: { "name": "disable-registration", "version": "1.0.0", "description": "", "main": "index.js", "scripts": { "build": "webpack", "test": "echo \"Error: no test specified\" && exit 1", "watch": "npm-watch" }, "babel": { "presets": [ "env" ] }, "watch": { "build": "src/*.js" }, "keywords": [], "author": ""

Babel doesn't recognize jinja2 extraction method for language support

谁说胖子不能爱 提交于 2019-12-05 07:45:12
I'm adding language translation support to my project. The code is on Python and has jinja2 in the html files, and Javascript. I'm trying to use Babel to do the translation, but it doesn't recognize the extraction method of jinja2. Maybe I'm using an incorrect name for it. This is my ini file: # Extraction from Python source files [python: **.py] # Extraction from Jinja2 template files [jinja2: **.html] # Extraction from JavaScript files [javascript: **.js] extract_messages = $._, jQuery._ And this is the error I receive; C:\>python Babel-0.9.6/babel/messages/frontend.py extract --project=GV -

Vue 3 CLI - How to add babel polyfill for Object.entries

家住魔仙堡 提交于 2019-12-05 07:01:55
I have a dependency (vue2-google-maps) which is causing issues with my Vue app in older browsers, throwing an error with Object.entries . Reading the Vue CLI Docs on polyfills , I see it mention trying to load the polyfill in babel.config.js . My babel.config.js : module.exports = { presets: [ ['@vue/app', { polyfills: [ 'es6.object' ] }] ] } Throws an error: Module build failed (from ./node_modules/babel-loader/lib/index.js): TypeError: [BABEL] /PROJECT_DIR/src/main.js: Cannot read property 'android' of undefined (While processing: "/PROJECT_DIR/node_modules/@vue/babel-preset-app/index.js")

Avoid an error when destructuring from undefined

a 夏天 提交于 2019-12-05 03:39:04
Lets say I have this code: const {x, y} = point; Babel will turn this into: var _point = point, x = _point.x, y = _point.y; Which is fine, but what if point is undefined? Now I get an error: "Cannot read property 'x' of undefined" . So how do I avoid this? I want to do something like const {x, y} = {} = point; but that's a syntax error. I can only see that this is an option: const {x, y} = point || {}; Which babel transpiles to: var _ref = point || {}, x = _ref.x, y = _ref.y; Here we're creating an object just to avoid an undefined error. This seems wasteful. Is there some syntax I'm missing