babeljs

Use Babel to transform jsx only

与世无争的帅哥 提交于 2020-12-13 04:14:35
问题 I am using Babel with React js. Problem is I don't want to convert es6 to es5. I want to keep using es6. I only need to transform jsx to js. This is my .babelrc { "plugins": ["transform-react-jsx"] } This is my code: import React from "react"; /****** Header *******/ export class Header extends React.Component { onSubmit = (e) => { e.preventDefault(); console.log('Submitting'); const errors = this.validate(); if (Object.keys(errors).length === 0) { this.setState({ loading: true }); fetch(this

Use Babel to transform jsx only

穿精又带淫゛_ 提交于 2020-12-13 04:14:07
问题 I am using Babel with React js. Problem is I don't want to convert es6 to es5. I want to keep using es6. I only need to transform jsx to js. This is my .babelrc { "plugins": ["transform-react-jsx"] } This is my code: import React from "react"; /****** Header *******/ export class Header extends React.Component { onSubmit = (e) => { e.preventDefault(); console.log('Submitting'); const errors = this.validate(); if (Object.keys(errors).length === 0) { this.setState({ loading: true }); fetch(this

TypeError: Duplicate declaration, Module build failed Error in Typescript Project [closed]

筅森魡賤 提交于 2020-12-13 03:42:04
问题 Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed last month . Improve this question Good Day, I have code something like below In A.ts file: declare class LayerManager { //code constructor(factory: Factory); //code } let self: LayerManager; function LayerManager(factory: Factory) { //code self = this; //code } export default LayerManager; In B

Parcel - Babel - Vue - Error: Cannot find module `…/…/img.svg`

自古美人都是妖i 提交于 2020-12-13 03:41:07
问题 Im a bit in the dark therefore reaching out as I couldnt find a solution or answer. Im using parcel with Vue and trying to import a static image as ../img/logo.svg . This used to work before until I introduced Babel to the mix. Now I get Error: Cannot find module 'img/logo.svg' during runtime. It is weird because in the dist folder I see a logo.svg with a hash. Is it a babel or parcel issue? do I need some extra plugin? or something Im missing?. Im basically using babel out the box. I just

TypeError: Duplicate declaration, Module build failed Error in Typescript Project [closed]

妖精的绣舞 提交于 2020-12-13 03:39:05
问题 Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed last month . Improve this question Good Day, I have code something like below In A.ts file: declare class LayerManager { //code constructor(factory: Factory); //code } let self: LayerManager; function LayerManager(factory: Factory) { //code self = this; //code } export default LayerManager; In B

TypeError: Duplicate declaration, Module build failed Error in Typescript Project [closed]

白昼怎懂夜的黑 提交于 2020-12-13 03:38:08
问题 Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed last month . Improve this question Good Day, I have code something like below In A.ts file: declare class LayerManager { //code constructor(factory: Factory); //code } let self: LayerManager; function LayerManager(factory: Factory) { //code self = this; //code } export default LayerManager; In B

Parcel - Babel - Vue - Error: Cannot find module `…/…/img.svg`

回眸只為那壹抹淺笑 提交于 2020-12-13 03:35:59
问题 Im a bit in the dark therefore reaching out as I couldnt find a solution or answer. Im using parcel with Vue and trying to import a static image as ../img/logo.svg . This used to work before until I introduced Babel to the mix. Now I get Error: Cannot find module 'img/logo.svg' during runtime. It is weird because in the dist folder I see a logo.svg with a hash. Is it a babel or parcel issue? do I need some extra plugin? or something Im missing?. Im basically using babel out the box. I just

Babel JS — simply convert JavaScript STRING to es5 (USING nodejs)

橙三吉。 提交于 2020-12-13 03:31:41
问题 I've been googling a lot and found a lot of half-answers or answers that don't address my question, so: I'm just trying to take an input string , that string being regular-source javascript code (NOT nodejs, JUST regular JavaScript) and convert that into another STRING ( not a file ) that contains browser-compatible JavaScript (es5 or whatever). I'm NOT trying to run nodejs as es5, and I'm not trying to convert a single file, I want to take a string of newer JavaScript and get a string of

Babel JS — simply convert JavaScript STRING to es5 (USING nodejs)

纵饮孤独 提交于 2020-12-13 03:27:14
问题 I've been googling a lot and found a lot of half-answers or answers that don't address my question, so: I'm just trying to take an input string , that string being regular-source javascript code (NOT nodejs, JUST regular JavaScript) and convert that into another STRING ( not a file ) that contains browser-compatible JavaScript (es5 or whatever). I'm NOT trying to run nodejs as es5, and I'm not trying to convert a single file, I want to take a string of newer JavaScript and get a string of

Is it possible to transpile jQuery to Vanilla JS?

北城余情 提交于 2020-12-05 11:53:25
问题 I use traceur / babel to transpile ES6 to ES5 but is it possible to use an gulp plugin to transpile jQuery to plain javascript? Thanks for Your answers :) 回答1: You can open the jquery.js and look for the relevant functions you want to convert to native javascript. Copy it into a new helper.js, include it instead of jquery.js (or jquery.min.js) and use this functions. Voila, native js-functions. 回答2: There is no gulp plugin to transpile jQuery to javascript. This is somewhat related to this