babel-core

Error: Cannot load preset env relative to / in a browser

大憨熊 提交于 2021-02-10 17:29:48
问题 I am creating interactive JavaScript coding exercise using ACE editor. to execute entered code have have to transform code. for that i am using @balel/core transform method. I am facing below problems when I use presets: ["env"] in options i am getting Error: Cannot load preset env relative to / in a browser . I already did npm install babel-preset-env to install preset transform is not overriding option babelrc: true 回答1: cannot run babe-core in browser begin with version 6.0. only node so

babel@7 and jest configuration

旧巷老猫 提交于 2020-05-24 21:15:11
问题 Maybe you may help me? I try to configure jest to use babel@7 So I have: "jest": "^23.4.1", "@babel/core": "^7.0.0-beta.54", "babel-7-jest": "^21.3.3", "babel-jest": "^20.0.3", And jest config inside package.json "jest": { "transform": { "^.+\\.js$": "babel-7-jest", }, And got TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string But if I use "jest": { "transform": { "^.+\\.js$": "babel-jest", }, I got Requires Babel "^7.0.0-0", but was loaded with "6.26.3". If you are

babel@7 and jest configuration

大城市里の小女人 提交于 2020-05-24 21:14:32
问题 Maybe you may help me? I try to configure jest to use babel@7 So I have: "jest": "^23.4.1", "@babel/core": "^7.0.0-beta.54", "babel-7-jest": "^21.3.3", "babel-jest": "^20.0.3", And jest config inside package.json "jest": { "transform": { "^.+\\.js$": "babel-7-jest", }, And got TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string But if I use "jest": { "transform": { "^.+\\.js$": "babel-jest", }, I got Requires Babel "^7.0.0-0", but was loaded with "6.26.3". If you are

Babel throws a type error when exporting aggregates

不羁岁月 提交于 2020-05-13 06:41:15
问题 When running my gulp task, I get the following error: SyntaxError in plugin "gulp-babel" Message: /Users/******/Repos/******/src/scripts/config/index.js: Unexpected export specifier type > 1 | export * as constants from './constants'; ^^^^^^^^^^^^^^ I'm not sure why this is as I am running the required plugins to allow ES6 imports/exports, or so I thought... .babelrc { "presets": [ "@babel/preset-env", "@babel/preset-react" ], "plugins": [ "add-module-exports", "@babel/plugin-transform

Use Babel Transform inside of React code

和自甴很熟 提交于 2019-12-12 17:13:08
问题 I'm trying to convert a string to valid JSX code, and then inject it into my React component. const babel = require('babel-core') let result = eval(babel.transform('<p className="greeting">Hello</p>').code) But am getting hit with a wall of errors, because I'm trying to use Babel in the browser: ERROR in ./~/babel-core/lib/api/node.js Module not found: Error: Can't resolve 'fs' in '/Users/ben/Desktop/Work/code/ru-coding-challege/node_modules/babel-core/lib/api' @ ./~/babel-core/lib/api/node

I am getting a 404 error on my new Reactjs app, is it looking for a main.js file?

会有一股神秘感。 提交于 2019-12-11 05:42:50
问题 This app should be rendering what I have here (/Users/ldco2016/Projects/reactquiz/src/components/App.jsx: import React, {Component} from 'react'; import ReactDOM from 'react-dom'; class App extends Component{ render(){ return( <div> APP </div> ) } } export default App but instead I get a blank page and the Chrome Dev tools console is telling me this: GET http://localhost:8080/app/js/main.js 404 (Not Found) I know what that means but I am unclear as to whether it is trying to find the page I

babel vs babel-core vs babel-loader vs babel-preset-2015 vs babel-preset-react vs babel-polyfill

徘徊边缘 提交于 2019-11-29 23:36:27
I was setting up Webpack for my React project and got confused between babel , babel-core , babel-loader , babel-preset-2015 and babel-preset-react . I know that Babel is needed to transform ES7 or ES6 code to ES5 but in my package.json I have installed all these dependencies except Babel and they also as devDependencies . Can someone please explain what's the difference between all these and why all of them are needed for my project? Isn't there any single dependency to replace them all? And if they are so important, why are they included as devDependencies ? babel Babel doesn't do anything

babel vs babel-core vs babel-loader vs babel-preset-2015 vs babel-preset-react vs babel-polyfill

被刻印的时光 ゝ 提交于 2019-11-28 17:25:43
问题 I was setting up Webpack for my React project and got confused between babel , babel-core , babel-loader , babel-preset-2015 and babel-preset-react . I know that Babel is needed to transform ES7 or ES6 code to ES5 but in my package.json I have installed all these dependencies except Babel and they also as devDependencies . Can someone please explain what's the difference between all these and why all of them are needed for my project? Isn't there any single dependency to replace them all? And