babel

How do I import FullCalendar on my React Project?

不打扰是莪最后的温柔 提交于 2019-12-12 15:13:32
问题 I am getting TypeError: __webpack_require__.i(...) is not a function error when I am trying import FullCalendar from '@fullcalendar/react' on my project which is configured with webpack. I tried manipulating webpack.config.dev.js but couldn't figure out how to implement it in a right way. whenever I am trying to import any of the component from @fullcalendar it is throwing me the webpack error webpack.config.dev.js: import webpack from 'webpack'; import HtmlWebpackPlugin from 'html-webpack

How to import JS in TS with noImplicityAny and without allowJs

强颜欢笑 提交于 2019-12-12 13:13:21
问题 I'm using Webpack and @babel/typescript to compile a mixed TypeScript and JavaScript project. I'm using --noImplicitAny to encourage taking advantage of typing. I'm not using --allowJs because my project is so big that it chokes the TypeScript compiler, and it destroys Visual Studio highlighting/Intellisense. For un-typed npm modules, if I don't have time to add typings, I create a definition file to explicitly set its type to any . For example example.ts import * as elemDataset from 'elem

How to use babel loader on node_modules in webpack for ES6+?

北战南征 提交于 2019-12-12 12:52:33
问题 I have a react project and all the extensions of everything is .js, none of them use .jsx. I downloaded a new library react-pdf-js-infinite and it uses .jsx. In my webpack the loader as exceptions running on all of node_modules. How do i set it up so that it will run on the .jsx file in my node_module. I constantly get an error when i am trying to run my production build with webpack for it. Saying this file might need a loader and it is when the build is encounter the ecma standard of static

Flask Babel doesn't work

妖精的绣舞 提交于 2019-12-12 12:06:42
问题 I use Flask Babel to do I18N for flask admin project. But cannot make it works, even with simple template. Here are the codes, initialize babel first, app=Flask(__name__,template_folder='templates') app.config.from_object('config') csrf=CsrfProtect(app) bcrypt=Bcrypt(app) db=SQLAlchemy(app) babel=Babel(app) @babel.localeselector def get_locale(): return 'zh_Hans_CN' Add construct admin page and add I18N, I also tries lazy_gettext().Not work. # Create admin admin = admin.Admin(app, 'iInvest:',

React-Native 0.57: 'Can't find variable: require' with metro-react-native-babel-preset

↘锁芯ラ 提交于 2019-12-12 10:07:37
问题 I started a multiplatform project with code sharing between react-native and react-js. So I have a webpack setup for browser/Electron, and a react-native 0.57 setup for Android/iOS. The problem I'm having right now is the following: Can't find variable: require It might be a very bald question, but do I need anything else? I read, that React-native should support require by itself, but couldn't find anything related to this setup yet. .babelrc {"presets": ["module:metro-react-native-babel

React Native starter project bundling fails with Unexpected Token error

家住魔仙堡 提交于 2019-12-12 09:33:41
问题 I'm trying to create my first React Native app for Android using the instructions on https://facebook.github.io/react-native/docs/getting-started.html. After setting up the dependencies and connecting my Android device, I ran react-native init app cd app react-native run-android This starts the React Packager, which fails to bundle with this error: error: bundling failed: "TransformError: /Users/luky/dev/app/index.android.js: Unexpected token ) (While processing preset: \"/Users/luky/dev/app

Internationalization with python gae, babel and i18n. Can't output the correct string

走远了吗. 提交于 2019-12-12 09:10:07
问题 jinja_env = jinja2.Environment(loader = jinja2.FileSystemLoader(template_dir),extensions=['jinja2.ext.i18n'], autoescape = True) jinja_env.install_gettext_translations(i18n) config['webapp2_extras.i18n'] = { 'translations_path': 'locale', 'template_path': 'views' } app = webapp2.WSGIApplication([ ('/', MainController.MainPageHandler) ], config=config, debug=True) In the messages.po file. "Project-Id-Version: PROJECT VERSION\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" "POT-Creation-Date: 2013

Babel's TypeScript parsing is not consistent

故事扮演 提交于 2019-12-12 04:59:36
问题 I tried the following Angular component code (in TypeScript) in ASTExplorer by choosing babylon7-7.0.0-beta.12 and babelv7-7.0.0-alpha.12 and it parses, transforms and produces the exact output: import { Component, OnInit } from '@angular/core'; @Component({ selector: 'app-list', templateUrl: './list.component.html', styleUrls: ['./list.component.css'] }) export class ListComponent implements OnInit { data: [ 'Item 1', 'Item 2', 'Item 3', 'Item 4', 'Item 5' ]; constructor() { } ngOnInit() { }

Passing id with onClick function React

有些话、适合烂在心里 提交于 2019-12-12 03:58:24
问题 I am having problem with passing id to handleClick function and console.log'ing it into the console. I have tried simple example which works but i can not understand why it doesn't work in my implementation. Here is the code of working example: var obiekt = [{"Zdjecie":"http://i.imgur.com/A83qNiV.jpg"},{"Zdjecie":"http://i.imgur.com/wwOoOIc.png"}]; class NavbarList extends React.Component { constructor() { super(); this.state = { text: "Old Text", id: 0, isPasswordPage : false, isUsernamePage

How to update default react(CRA) to webpack4 and babel7?

本小妞迷上赌 提交于 2019-12-11 21:31:49
问题 If someone has done it, please help me with updating dependencies and webpack configuration file. 回答1: You will either need to eject and update configs yourself or wait for CRA v2 to be released which tackles both these issues. More context here: https://github.com/facebook/create-react-app/issues/3815 react-scripts is what abstracts and powers tooling like webpack and babel 来源: https://stackoverflow.com/questions/52466801/how-to-update-default-reactcra-to-webpack4-and-babel7