babeljs

How to use Native Node Modules on a React, ES6, Electron App?

北城余情 提交于 2021-01-27 04:41:34
问题 I have a React, Electron app that I wish to be able to access native node modules from the ES6 compiled (using Babel and Webpack). For example, when I try to require the "fs" node module to access the filesystem I get the following error. ERROR in ./src/app.js Module not found: Error: Cannot resolve module 'fs' in C:\Users\Propietario-1\Documents\GitHub\AMPLI @ ./src/app.js 1:358-371 But when I required this from a "none compiled" js file it works. I can access the "fs" module. Any help is

Exporting functions with reactjs and babel

假装没事ソ 提交于 2021-01-27 02:09:31
问题 I have a project using reactjs, which is transpiled by babel. I use the es2015 and react transforms in my .babelrc . I am currently refactoring and in my first pass I basically did export class foo for everything I needed. A lot of these classes should really just be functions, so I am trying to rewrite them as such, but I keep getting the same error. My main application file looks somethings like this: import React, { Component } from 'react'; import {Foo, Bar} from './components/ui.js';

Exporting functions with reactjs and babel

南楼画角 提交于 2021-01-27 02:05:06
问题 I have a project using reactjs, which is transpiled by babel. I use the es2015 and react transforms in my .babelrc . I am currently refactoring and in my first pass I basically did export class foo for everything I needed. A lot of these classes should really just be functions, so I am trying to rewrite them as such, but I keep getting the same error. My main application file looks somethings like this: import React, { Component } from 'react'; import {Foo, Bar} from './components/ui.js';

Babel throwing Support for the experimental syntax 'jsx' isn't currently enabled

泪湿孤枕 提交于 2021-01-26 03:15:02
问题 I started newly writing unit test cases using Jest and Enzyme for the react application and when try to run test cases using jest like "test": "jest --watch" rather "test": "react-scripts test" tests going through babel for the runner to understand react syntax. And have been doing setup step by step using babel but this error Support for the experimental syntax 'jsx' isn't currently enabled stopping me to go further. And as suggested in some threads I have been trying with npm install --save

Babel throwing Support for the experimental syntax 'jsx' isn't currently enabled

[亡魂溺海] 提交于 2021-01-26 03:13:08
问题 I started newly writing unit test cases using Jest and Enzyme for the react application and when try to run test cases using jest like "test": "jest --watch" rather "test": "react-scripts test" tests going through babel for the runner to understand react syntax. And have been doing setup step by step using babel but this error Support for the experimental syntax 'jsx' isn't currently enabled stopping me to go further. And as suggested in some threads I have been trying with npm install --save

Bundle JS with rollup and Babel for use in IE11

岁酱吖の 提交于 2021-01-23 11:09:22
问题 I try to bundle two JavaScript modules, so that the resulting code works in IE11. For this I have setup a yarn/npm project which uses rollup.js for bundling and Babel for transpiling. Everything works fine until I add the (non-dev) dependency core-js . Here the details: 1 Setup before adding core-js JS files src/main.js src/utils.js Config files package.json { "name": "rollup_for_ie", "devDependencies": { "@babel/core": "^7.11.1", "@babel/preset-env": "^7.11.0", "@rollup/plugin-babel": "^5.2

Bundle JS with rollup and Babel for use in IE11

风流意气都作罢 提交于 2021-01-23 11:09:10
问题 I try to bundle two JavaScript modules, so that the resulting code works in IE11. For this I have setup a yarn/npm project which uses rollup.js for bundling and Babel for transpiling. Everything works fine until I add the (non-dev) dependency core-js . Here the details: 1 Setup before adding core-js JS files src/main.js src/utils.js Config files package.json { "name": "rollup_for_ie", "devDependencies": { "@babel/core": "^7.11.1", "@babel/preset-env": "^7.11.0", "@rollup/plugin-babel": "^5.2

Bundle JS with rollup and Babel for use in IE11

℡╲_俬逩灬. 提交于 2021-01-23 11:08:14
问题 I try to bundle two JavaScript modules, so that the resulting code works in IE11. For this I have setup a yarn/npm project which uses rollup.js for bundling and Babel for transpiling. Everything works fine until I add the (non-dev) dependency core-js . Here the details: 1 Setup before adding core-js JS files src/main.js src/utils.js Config files package.json { "name": "rollup_for_ie", "devDependencies": { "@babel/core": "^7.11.1", "@babel/preset-env": "^7.11.0", "@rollup/plugin-babel": "^5.2

Uncaught Error:expected a string. You forgot export your component from the file its defined,or you might have mixed up default/named import

只愿长相守 提交于 2021-01-22 08:54:50
问题 Could you please help me to resolve the issue. I have already tried resolving the import functions but i still get that error and I have also tried to remove "{}" which didnt work. Thanks in advance. I am following TylerMcginnis React-Redux course. Navigation.js import React from 'react' import PropTypes from 'prop-types' import Link from 'react-router-dom' import { container, navContainer, link } from './styles.css' Navigation.propTypes = ActionLinks.propTypes = NavLinks.propTypes = {

Uncaught Error:expected a string. You forgot export your component from the file its defined,or you might have mixed up default/named import

狂风中的少年 提交于 2021-01-22 08:53:20
问题 Could you please help me to resolve the issue. I have already tried resolving the import functions but i still get that error and I have also tried to remove "{}" which didnt work. Thanks in advance. I am following TylerMcginnis React-Redux course. Navigation.js import React from 'react' import PropTypes from 'prop-types' import Link from 'react-router-dom' import { container, navContainer, link } from './styles.css' Navigation.propTypes = ActionLinks.propTypes = NavLinks.propTypes = {