babel

webpack资源处理

别来无恙 提交于 2019-12-04 09:33:16
使用上篇已谈过,这篇纯代码!!~~ <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>Document</title> <!-- <script src="../dist/bundle.js"></script> --> <!-- <link rel="stylesheet" href="/node_modules/bootstrap/dist/css/bootstrap.css"> --> </head> <body> <div class="box"></div> <div class="box2"></div> <span class="glyphicon glyphicon-heart" aria-hidden="true"></span> </body> </html> { "name": "01.webpack-study", "version": "1.0.0", "description": "", "main": "index

How to set JSX files default to Babel text highlighting in sublime

拈花ヽ惹草 提交于 2019-12-04 08:59:01
问题 I have a babel text highlighting that i added in my sublime. However every time I open a new react project it defaults to javascript text highlighting then i have to reset each javascript file to get the correct text highlighting. As you can see in the lower right of my screenshot it is by default set to javascript. 回答1: The syntax that Sublime selects is based primarily on the extension that the file has. You can select View > Syntax > Open all with current extension as... from the menu

使用Webpack4 搭建React项目

岁酱吖の 提交于 2019-12-04 08:38:42
使用Webpack 搭建React项目的方法和步骤 参考文章: 《How to Create a React app from scratch using Webpack 4 》 write by Linh Nguyen My 创建项目以及使用webpack编译项目 使用npm init新建功能,如果想要跳过各种询问,可以使用 -y命令: npm init -y 接下来要使用 webpack 作为开发的依赖项,以及 webpack-cli , 它可以让我们在命令行中使用webpack, 使用以下命令来安装: npm i webpack webpack-cli -D 命令解释 i:install -D: --dave-dev 以上命令等同于 npm install webpack webpack-cli --save-dev 创建一个src文件夹并在文件夹下创建index.js, 将以下示例代码写入index.js: console.log("hello"); 现在,修改package.json, 添加scripts中2条命令start 和 build,代码如下: { "name": "translation-tool-webpack-react", "version": "1.0.0", "description": "", "main": "index.js", "scripts

Dynamic Imports for Code Splitting cause: ESLint Parsing Error 'import'

假装没事ソ 提交于 2019-12-04 03:16:56
I'm using the VueJS Webpack template found here: https://github.com/vuejs-templates/webpack Example Route: const AuthRoute = () => import(/* webpackChunkName: "authroute" */ './AuthRoute.vue') Example Error: [eslint] Parsing error: Unexpected token import I've followed the steps provided in Webpack's Dynamic import section, as well as Anthony Gore's blog post on how to accomplish code splitting with VueJS at the router level. More specifically, here is my setup: Package.json ... "babel-core": "^6.22.1", "babel-eslint": "^8.0.3", "babel-jest": "^21.2.0", "babel-loader": "^7.1.1", "babel-plugin

Browserify - ParseError: 'import' and 'export' may appear only with 'sourceType: module

▼魔方 西西 提交于 2019-12-04 03:13:44
问题 In my gulpfile I have var gulp = require('gulp'); var browserSync = require('browser-sync').create(); var sass = require('gulp-sass'); var babel = require("gulp-babel"); var rename = require('gulp-rename'); var source = require('vinyl-source-stream'); var browserify = require('gulp-browserify'); var notify = require("gulp-notify"); gulp.task('js', function () { gulp.src('js/main.js') .pipe(babel()) .pipe(browserify()) .on('error', errorAlert) .pipe(rename('./dist/js/bundle.js')) //.pipe

Create React Native App. - Plugin/Preset files are not allowed to export objects, only functions

こ雲淡風輕ζ 提交于 2019-12-04 03:13:03
问题 Need some help, I'm getting a weird error out of left field that I have not been able to debug. This project was bundling successfully until yesterday after I setup my react native project on another Mac. I'm wondering if it's from versioning of npm packages I had to reinstall. Any direction would be helpful, it's always the setup that's the hardest because you do it so infrequently... My babelrc file is as follows -- { "presets": ["babel-preset-expo"], "env": { "development": { "plugins": [

Cannot define prototype properties within ES6 class definition

我与影子孤独终老i 提交于 2019-12-04 01:09:38
问题 I was trying ES6 syntax and find I cannot define prototype property or instance property within class defination, why forbids it? I was using MyClass.prototype.prop=1 before, try ES7 by babel compiler as below, still cannot define prototype property. class MyClass{ prop=1; static sProp=1; } I don't think define instance property is any dangerous, there's 2 cases in my own browser game need prototype property: Subclass instances need to inherit same property value from base class: var Building

IE10无法识别setPrototypeOf属性问题

六月ゝ 毕业季﹏ 提交于 2019-12-04 00:34:31
项目遇到一个需求,React16.6.0兼容IE10浏览器 首先在IE浏览器打开,IE11可以支持,打开控制台切换到IE10,页面白屏,控制台报错。 控制台报错 Map Set 未定义 既然没有定义,说明IE10不支持ES6最新语法。谷歌了好多方案。唯一有用的还是去了Babel官网,有关,@babel/polyfill的使用,以及它代表着什么? 之前用到了babel-polyfill,发现都是2017年的答案,现在库早就更新了,对于第一次听到这个库的人来说,未免不知所以然。 于是照着babel/polyfill官网所说去webpack.cong.dev.js的entry去配置了 entry : ["@babel/polyfill"] 结果出了其它错误,是自己引用别人第三方库的问题。 [Purchameng](valid Defined ) 此命令不支持 又去谷歌,索到,有人在github提问了,说使用的quill插件不支持IE10,得换插件。那好,就注释了项目所用的quill引用 果然IE10可以展示页面了。这中间跳了很多过程和解决问题的心理活动。需要慢慢梳理。 来源: https://www.cnblogs.com/baimeishaoxia/p/11825483.html

【2012.1.24更新】不要再在网上搜索eclipse的汉化包了!

拥有回忆 提交于 2019-12-04 00:01:33
2012.1.24更新 增加了“安装方法” eclipse是一个程序开发平台,它本身并不限制自己能开发什么语言的程序,而是由其他东西提供支持。 Eclipse的每个版本有对应的代号,3.6版叫Helios ,3.5版叫Galileo ,3.4版叫Ganymede。你可以参考维基百科的 eclipse条目 。 在 http://www.eclipse.org/downloads/ 你可以见到很多下载项目。 Eclipse IDE for Java Developers是eclipse+Java开发环境 Eclipse Classic 3.6.2是eclipse+Java开发环境+其他组件 Eclipse IDE for C/C++ Developers是eclipse+C/C++开发环境 点击每个项目,都可以在Package Details里看到进一步描述。 eclipse的全球化(汉化)工作不是由eclipse开发团队负责的,它属于eclipse旗下的项目(Project),叫Babel( 巴别 )。eclipse项目主页在 http://www.eclipse.org/projects/ 。 具体怎么找Babel这个项目呢,在右上角搜索,或点击All Projects。 值得注意的是,不论是在 http://www.eclipse.org/ 页面还是在 http://www

how to solve this error You may need an appropriate loader to handle this file type

隐身守侯 提交于 2019-12-03 23:39:45
I got this error with this library https://github.com/react-native-web-community/react-native-web-linear-gradient/ the error link https://github.com/react-native-web-community/react-native-web-linear-gradient/issues/1 details of error: Module parse failed: Unexpected token (5:22) You may need an appropriate loader to handle this file type. my webpack: 'use strict'; const autoprefixer = require('autoprefixer'); const path = require('path'); const webpack = require('webpack'); const HtmlWebpackPlugin = require('html-webpack-plugin'); const CaseSensitivePathsPlugin = require('case-sensitive-paths