babel

Webpack - Error: Cannot define 'query' and multiple loaders in loaders list

匿名 (未验证) 提交于 2019-12-03 02:44:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: The error appeared after I added 'react-hot' loader in array. I've followed this tutorials: https://robots.thoughtbot.com/setting-up-webpack-for-react-and-hot-module-replacement however, i'm getting Error: Cannot define 'query' and multiple loaders in loaders list . var WebpackDevServer = require("webpack-dev-server"); var webpack = require('webpack'); var path = require('path'); require("babel-polyfill"); var BUILD_DIR = path.resolve(__dirname, 'build'); var APP_DIR = path.resolve(__dirname, 'src'); module.exports = { entry: [ 'babel

Webpack + Babel error

匿名 (未验证) 提交于 2019-12-03 02:38:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am trying to configure webpack and had everything up and running, but am now getting this same error. I've combed through a few other posts that seem to have been resolved by correcting spelling/grammar errors, but I can't seem to pinpoint anything wrong in my code. Is there something more serious happening? ERROR in ./src/components/App/App.js Module parse failed: /Users/Desktop/fred/src/components/App/App.js Unexpected token (7:11) You may need an appropriate loader to handle this file type. | | render() { | return ( | <h1>Hello</h1>; |

Assert arrays using Chai (or Should) in Javascript ES6 (using Babel)

匿名 (未验证) 提交于 2019-12-03 02:33:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I'm trying to test an array such as: let projects = [ { "id" : "55a75be01fa2c7ff76a2ce7a" , "title: " Only - Ben ", " other_keys ": " that can contain objects or arrays " }, { " id ": " 55a75be01fa2c7ff76a2ce7d ", " title : "Only-Thomas" }, { "id" : "55a75be01fa2c7ff76a2ce7c" , "title: " Other - Project " } ]; The goal is to test that the array Contains an element which has a key {title: 'Only Ben'} Do not contain an element which has a key {title: 'Only Thomas'} I'm currently using chai.js and chai things with this test: projects

Babel / Karma / Chai gives TypeError: &#039;caller&#039;, &#039;callee&#039;, and &#039;arguments&#039; properties may not be accessed on strict mode functions

匿名 (未验证) 提交于 2019-12-03 02:30:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I having trouble figuring out why this test is not passing. var expect = require('chai').expect; describe('HelloComponent', function() { it('passes a quite simple test', function() { expect(1 + 4).to.equal(5); }); }); produces this error: DEBUG [web-server]: serving: /Users/ivan/dev/react-starter/node_modules/karma/static/context.html DEBUG [web-server]: serving (cached): /Users/ivan/dev/react-starter/node_modules/mocha/mocha.js DEBUG [web-server]: serving (cached): /Users/ivan/dev/react-starter/node_modules/karma-mocha/lib/adapter.js DEBUG

Webpack and React ― Unexpected token

匿名 (未验证) 提交于 2019-12-03 02:29:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I am new to React and Webpack. I am setting up my first project, when I try to run the webpack-dev-server my code does not compile! Update Answer below is correct. I needed to add 'react' to babel loader presets. You can see the full source for project here: https://github.com/cleechtech/redux-todo Error: $ webpack - dev - server http : //localhost:8080/webpack-dev-server/ webpack result is served from / content is served from ./ dist Hash : d437a155a1da4cdfeeeb Version : webpack 1.12 . 14 Time : 5938ms Asset Size Chunks Chunk

Babel error: Class constructor Foo cannot be invoked without &#039;new&#039;

匿名 (未验证) 提交于 2019-12-03 02:26:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am using babel to transpile. I have class BaseComponent which is extended by class Logger . When I run new Logger() in the browser, I am getting this error Class constructor BaseComponent cannot be invoked without 'new' the code that throws this is: var Logger = function (_BaseComponent) { _inherits(Logger, _BaseComponent); function Logger() { _classCallCheck(this, Logger); return _possibleConstructorReturn(this, Object.getPrototypeOf(Logger).call(this, "n")); //throws here } 回答1: Due to the way ES6 classes work, you cannot extend a native

`Unexpected token import` in `webpack.config.babel.js` when using `{modules: false}`

匿名 (未验证) 提交于 2019-12-03 02:24:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have a React project which uses Webpack as the module bundler, and babel-loader to transform it into ES5, using the following settings: module: { rules: [ { test: /\.jsx?$/, exclude: /node_modules/, use: [ { loader: "babel-loader" } ] } ] }, The options are set in a stand-alone .babelrc file. Babel 6.13.0 supports ECMAScript modules, which means ECMAScript modules doesn't need to be transformed into CommonJS modules first. To get this behaviour, the documentation says that we should use this setting in our .babelrc . { presets: [["es2015",

grunt babel 100 kb styling issue

匿名 (未验证) 提交于 2019-12-03 02:23:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: When i am running grunt babel task, its keep giving me Note : Running "babel:dist" (babel) task [BABEL] Note: The code generator has deoptimised the styling of "common.js" as it exceeds the max of "100KB". [BABEL] Note: The code generator has deoptimised the styling of "detailjs" as it exceeds the max of "100KB". Could someone please tell me why this happens and what is the fix for this ? 回答1: This is not a bug in your code. Babel is reporting that the files common.js and detailjs are greater than 100 KB in size, which means that Babel will

Node error: SyntaxError: Unexpected token import

匿名 (未验证) 提交于 2019-12-03 02:08:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I don't understand what is wrong. I checked other forum talking about transpilation and babel. What do I have to do? node -v v5.5.0 my code: import recast from 'recastai' and the error (function (exports, require, module, __filename, __dirname) { import recast from 'module1' ^^^^^^ SyntaxError: Unexpected token import at exports.runInThisContext (vm.js:53:16) at Module._compile (module.js:387:25) at Object.Module._extensions..js (module.js:422:10) at Module.load (module.js:357:32) at Function.Module._load (module.js:314:12) at Function

Error: Couldn&#039;t find preset “es2015” relative to directory “/Users/username”

匿名 (未验证) 提交于 2019-12-03 02:06:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I get the following error when trying to use gulp-babel: Error: Couldn't find preset "es2015" relative to directory "/Users/username" I have the es2015 preset installed globally and locally so can't see why this would be an issue. Below is my gulp set up and package.json. var babel = require('gulp-babel'); var es2015 = require('babel-preset-es2015'); gulp.task('babel', function() { return gulp.src('./app/main.js') .pipe(babel({ presets: [es2015] })) .pipe(gulp.dest('dist')); }); Package.json "devDependencies": { "babel-preset-es2015": "^6.3