babel

vue项目,ie,360报错"promise未定义错误"和"Invalid Host/Origin header"解决办法

我的梦境 提交于 2020-01-19 02:06:12
vue项目在ie或者360浏览器打开,报错" promise未定义错误 ",低版本浏览器不兼容axios请求的promise; 解决办法一:安装 babel-polyfill依赖 npm install --save babel-polyfill main.js文件引入 import 'babel-polyfill' webpack.base.conf.js文件修改,标记部分修改 重新启动项目 如果还继续报错:安装 url-search-params-polyfill依赖 npm install --save url-search-params-polyfill main.js引入 import 'url-search-params-polyfill' 重新启动项目即可 控制台错误日志无限循环: Invalid Host/Origin header 在webpack.dev.conf.js文件下加上: disableHostCheck: true 即可 来源: CSDN 作者: 南有樛木。 链接: https://blog.csdn.net/qq_35310623/article/details/103953921

用webpack搭建vue项目(一)

╄→гoц情女王★ 提交于 2020-01-17 06:39:35
首先要安装node 一、webpack 1、新建一个文件夹amazing,然后进入文件夹 命令行运行 npm init - y ( y -- 》代表yes ,省去了默认选项点击 ) 然后命令行中一顿回车 完成后,生成一个package.json文件 2、安装webpack和webpack-cli npm install webpack webpack - cli -- save - dev 3、在文件中创建src、public两个文件夹和webpack.config.js配置文件 ①、在子文件夹public中新建index.html(此文件为入口文件模板,注意是模板) ②、在子文件夹src内新建main.js文件(此文件为项目入口主js文件) ③、webpack-config.js const path = require ( 'path' ) ; module . exports = { entry : { app : './src/main.js' //需要打包的文件 } , output : { filename : 'bundle.js' , //输入的文件名是什么,dist里面生成的文件名也是什么 path : path . resolve ( __dirname , 'dist' ) //指定生成的文件目录 } } ; 4、安装webpack-dev-server

Vue项目之IE下打开页面是空白

不羁岁月 提交于 2020-01-17 01:08:29
原因是:Babel 默认只转换新的 JavaScript 句法(syntax),而不转换新的 API ,比如 Iterator、Generator、Set、Maps、Proxy、Reflect、Symbol、Promise 等全局对象,以及一些定义在全局对象上的方法(比如 Object.assign)都不会转码。为了解决这个问题,我们使用一种叫做 Polyfill(代码填充,也可译作兼容性补丁) 的技术。 解决办法: 主要有俩个地方引起错误:vuex和axios 下载babel-polyfill和es6-promise 在入口文件App.vue引入import 'babel-polyfill' 给每个使用axios的地方加上 require('es6-promise').polyfill(); 来源: https://www.cnblogs.com/zhaobao1830/p/7727115.html

React Development and Build version not working in IE 11 and Edge - Webpack/Babel

房东的猫 提交于 2020-01-16 19:31:34
问题 Development and build version not working in IE 11 and Edge. Here are my webpack config and package json file. I have used below repo. https://github.com/kriasoft/react-starter-kit I have been trying to fix this issue using various babel packages and webpack configurations. Arrow function seems not to be working. Here's the error. webpack.config.js /** * React Starter Kit (https://www.reactstarterkit.com/) * * Copyright © 2014-present Kriasoft, LLC. All rights reserved. * * This source code

setting up the babel plugin for spread operator correctly

*爱你&永不变心* 提交于 2020-01-16 18:57:09
问题 Attempting to use babel-plugin-transform-es2015-spread in my project. Installed the module. npm install --save-dev babel-plugin-transform-es2015-spread .babelrc looks like. { "presets": [ ["env", { "include": ["babel-plugin-transform-es2015-spread"] }] ] } Registering babel in my main.js // babel require('babel-core/register') require('babel-polyfill') But the below code snippet still throws (Unexpected token) error return { ...state, hoverTrend: action.trend, } 回答1: The plugin babel-plugin

setting up the babel plugin for spread operator correctly

天大地大妈咪最大 提交于 2020-01-16 18:55:53
问题 Attempting to use babel-plugin-transform-es2015-spread in my project. Installed the module. npm install --save-dev babel-plugin-transform-es2015-spread .babelrc looks like. { "presets": [ ["env", { "include": ["babel-plugin-transform-es2015-spread"] }] ] } Registering babel in my main.js // babel require('babel-core/register') require('babel-polyfill') But the below code snippet still throws (Unexpected token) error return { ...state, hoverTrend: action.trend, } 回答1: The plugin babel-plugin

How to pass an array as props in React without being converted to string

末鹿安然 提交于 2020-01-16 16:48:56
问题 I'm developing a university administration website with React that can be displayed in different languages. So far, I have developed the Login page, please see the code (note that I'm using Babel ): import React from 'react' import PropTypes from 'prop-types' import { fetchPopularRepos } from '../utils/api' function LanguagesNav ({ selected, onUpdateLanguage}) { const languages = ['EU', 'ES', 'EN'] return ( <div > <h1 className='center-text header-lg'> GAUR 2.0 </h1> <ul className='flex

Does Babel transpile Map to be usable in IE11?

…衆ロ難τιáo~ 提交于 2020-01-15 12:13:49
问题 Looking at Map documentation, it looks like it is not fully supported in IE11: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map Does Babel convert Map.set and Map.get to be functional for IE? 回答1: The easy part is figuring out what the different transpilers and browsers support. See this link for this information. From this you can see what portion of Map is supported by IE11, for example, and of course, what Babel support is like (quite good for Map with

Does Babel transpile Map to be usable in IE11?

旧时模样 提交于 2020-01-15 12:09:24
问题 Looking at Map documentation, it looks like it is not fully supported in IE11: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map Does Babel convert Map.set and Map.get to be functional for IE? 回答1: The easy part is figuring out what the different transpilers and browsers support. See this link for this information. From this you can see what portion of Map is supported by IE11, for example, and of course, what Babel support is like (quite good for Map with

serving i18n js using babel, django, & jinja2

▼魔方 西西 提交于 2020-01-15 10:43:37
问题 Using django, with jinja2 for rendering & babel for message extraction I have some js files that need to be internationalized. I haven't been able to figure out a syntax for extracting messages from them which would also let jinja2 render them. Either jinja2 has to learn to read an extractable syntax, or I have to extract from something jinja2 can render. (Or, do this another way entirely) Extracting If I mark messages in the js with gettext('message') It extracts just fine. Rendering But