babel

Requires Babel “7.0.0-0” but was loaded with “6.26.3”

痴心易碎 提交于 2019-12-18 11:17:20
问题 Keep getting this error no matter what I tried installing (babel wise) as I follow other similar reports. this is the stack trace: error: bundling failed: Error: Requires Babel "^7.0.0-0", but was loaded with "6.26.3". If you are sure you have a compatible version of @babel/core, it is likely that something in your build process is loading the wrong version. Inspect the stack trace of this error to look for the first entry that doesn't mention "@babel/core" or "babel-core" to see what is

How to use mobx in react-native 0.56 (Babel 7) with Decorators

孤街醉人 提交于 2019-12-18 10:54:45
问题 i've upgraded my RN app from 0.55.4 to 0.56 that use Babel 7. In 0.55.4 to use decorators for MOBX i use "babel-plugin-transform-decorators-legacy" but is not compatible with Babel 7... react-native ver: 0.56.0 mobx ver: 5.0.3 mobx-react ver: 5.2.3 does anyone have the solution? Thanks UPDATE: The app works in DEBUG with this configuration package.json ... "devDependencies": { "@babel/core": "7.0.0-beta.47", "@babel/plugin-proposal-decorators": "7.0.0-beta.47" ... } .babelrc { "presets": [ [

Destructuring assignment to costruct a new object - Is it possible? [duplicate]

守給你的承諾、 提交于 2019-12-18 07:15:15
问题 This question already has answers here : Is it possible to destructure an object and generate a new object in a single statement? [duplicate] (2 answers) How to get a subset of a javascript object's properties (23 answers) One-liner to take some properties from object in ES 6 (11 answers) Closed 2 years ago . Is it possible to use destructuring assignment syntax to make it possible to extract data objects into another object instead distinct variables? Example which produce distinct variables

Destructuring assignment to costruct a new object - Is it possible? [duplicate]

倾然丶 夕夏残阳落幕 提交于 2019-12-18 07:15:02
问题 This question already has answers here : Is it possible to destructure an object and generate a new object in a single statement? [duplicate] (2 answers) How to get a subset of a javascript object's properties (23 answers) One-liner to take some properties from object in ES 6 (11 answers) Closed 2 years ago . Is it possible to use destructuring assignment syntax to make it possible to extract data objects into another object instead distinct variables? Example which produce distinct variables

Whats the difference when configuring webpack babel-loader vs configuring it within package.json?

ぐ巨炮叔叔 提交于 2019-12-18 06:06:28
问题 Hi please help me understand the differences between setting babel config inside .babelrc vs webpack loader options, vs inserting it in package.json. For example, Would it make any difference if I put the presets in the webpack babel-loader options vs package.json or a separate .babelrc config file? In webpack config: { test: /\.(js|jsx|mjs)$/, loader: require.resolve('babel-loader'), options: { "presets": [ "react-app" ] }, }, In package json: "babel": { "presets": [ "react-app" ] }, 回答1:

Cannot find module './src/data' with vue-cli

安稳与你 提交于 2019-12-18 04:33:32
问题 I created a project with vue-cli 4.1.1, and after running yarn serve, i got the following error Error: [BABEL] C:\dev\vuestudy\src\main.js: Cannot find module './src/data' (While processing: "C:\\dev\\vuestudy\\node_modules\\@vue\\cli-plugin-babel\\preset.js") Any tips on this? Thanks in advance. UPDATE: Kousha and Dave are right,after waiting for the core-js package update, I created a new project, and now it's working. 回答1: It looks like there's been a bad build of npm package core-js

使用@babel/preset-typescript取代awesome-typescript-loader和ts-loader

不羁岁月 提交于 2019-12-18 02:09:05
前言 之前写过一篇旧React项目安装并使用TypeScript的文章: 在React旧项目中安装并使用TypeScript的实践 。 博客里使用awesome-typescript-loader对Typescript代码进行检测和转换。 而这几天又修改了一下自己的脚手架,使用@babel/preset-typescript来处理Typescript。 回顾awesome-typescript-loader方案 谈@babel/preset-typescript的优越性之前,还是先说下awesome-typescript-loader方案是如何对TypeScript进行处理的。 首先我们需要知道TypeScript是一个将TypeScript转换为指定版本JS代码的编译器,而Babel同样是一个将新版本JS新语法转换为低版本JS代码的编译器。 所以我们之前的方案每次修改了一点代码,都会将TS代码传递给TypeScript转换为JS,然后再将这份JS代码传递给Babel转换为低版本JS代码。 因此我们需要配置两个编译器,并且每次做了一点更改,都会经过两次编译。 @babel/preset-typescript方案 介绍这个方案之前,我需要列出我参考的一篇译文: [译] TypeScript 和 Babel:一场美丽的婚姻 。 这里提到这是 TypeScript 和 Babel

What's the difference between babel-preset-stage-0, babel-preset-stage-1 etc?

那年仲夏 提交于 2019-12-17 17:27:18
问题 My question is : What's the difference between babel-preset-stage-0 , babel-preset-stage-1 , babel-preset-stage-2 and babel-preset-stage-3 , and what's the best choice when we develop with ES6 ? 回答1: Babel's stage presets equate to the TC39 Process and the different states of each proposal for a potential language change. They include implementations and polyfills for all of the proposed changes in that stage. Anything currently in Stage-0 is Strawman, not ES6. It is future Javascript and

Preferred way of using Bootstrap in Webpack

孤街浪徒 提交于 2019-12-17 16:27:13
问题 Greetings one and all, I have been playing around with Bootstrap for Webpack, but I'm at the point of tearing my hair out. I have literally gone through loads of blog articles and they either use the 7 months outdated 'bootstrap-webpack' plugin (which, surprisingly does not work out of the box) or.. They include the Bootstrap files through import 'node_modules/*/bootstrap/css/bootstrap.css'. Surely, there must be a cleaner and more efficient way of going about this? This is my current webpack

SyntaxError with Jest and React and importing CSS files

荒凉一梦 提交于 2019-12-17 10:52:03
问题 I am trying to get my first Jest Test to pass with React and Babel. I am getting the following error: SyntaxError: /Users/manueldupont/test/avid-sibelius-publishing-viewer/src/components/TransportButton/TransportButton.less: Unexpected token > 7 | @import '../variables.css'; | ^ My package.json config for jest look like this: "babel": { "presets": [ "es2015", "react" ], "plugins": [ "syntax-class-properties", "transform-class-properties" ] }, "jest": { "moduleNameMapper": { "^image![a-zA-Z0-9