babel

Jest not parsing es6: SyntaxError: Unexpected token import

ぃ、小莉子 提交于 2019-12-22 03:50:37
问题 I am trying to setup Jest with my webpack project. When I run my tests, Jest complains it cannot read es6 code. Babel seems to not transform my test files. I have tried various solutions I have found on the internet but I'm still stumped. Maybe somebody with more Babel/Webpack knowledge can look at my config and help me out. relevant package.json script: { "test": "jest --no-cache --config config/jest.config.js" } relevant package.json deps: "@babel/core": "^7.2.2", "@babel/plugin-proposal

how to solve this error You may need an appropriate loader to handle this file type

我只是一个虾纸丫 提交于 2019-12-21 07:13:09
问题 I got this error with this library https://github.com/react-native-web-community/react-native-web-linear-gradient/ the error link https://github.com/react-native-web-community/react-native-web-linear-gradient/issues/1 details of error: Module parse failed: Unexpected token (5:22) You may need an appropriate loader to handle this file type. my webpack: 'use strict'; const autoprefixer = require('autoprefixer'); const path = require('path'); const webpack = require('webpack'); const

how to solve this error You may need an appropriate loader to handle this file type

元气小坏坏 提交于 2019-12-21 07:13:08
问题 I got this error with this library https://github.com/react-native-web-community/react-native-web-linear-gradient/ the error link https://github.com/react-native-web-community/react-native-web-linear-gradient/issues/1 details of error: Module parse failed: Unexpected token (5:22) You may need an appropriate loader to handle this file type. my webpack: 'use strict'; const autoprefixer = require('autoprefixer'); const path = require('path'); const webpack = require('webpack'); const

React.js files syntax in sublime text 3

和自甴很熟 提交于 2019-12-21 07:05:29
问题 i am using sublime text 3 as my code editor,i have written a basic hello world example in React.but the coloring is improper on the code ,i have tried installing Babel plugin but even after that also the coloring doesn't seem to work ,as you can see the image below 回答1: Just installing it isn't enough, you have to also tell SublimeText to use it. Either do a) Ctrl - Shift - P , type "Babel" and select Set Syntax: Javascript(Babel) or b) Go to the menu and do View->Syntax->Open all with

Can babel-standalone be used if index.html is served locally ? (no webserver)

£可爱£侵袭症+ 提交于 2019-12-21 05:41:20
问题 Before i start the question, here is what i already know to avoid answers along the same lines. TL;DR: I already know I can use a webserver and serve the index.html as http://localhost:8081/index.html and it will work. Now for the question details: I have created a minimal react-js app, referencing babel-standalone in the index.html file as follows: <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport"

Flask-Babel localized strings within js

陌路散爱 提交于 2019-12-21 05:03:30
问题 I'm pretty new to both Python and Flask (with Jinja2 as template engine) and I am not sure I am doing it the right way. I am using Flask-Babel extension to add i18n support to my web application. I want to get localized strings from my js code, for instance: var helloWorld = gettext('Hello, world'); console.log(helloWorld); //should log a localized hello world message For this, I configured babel (babel.cfg): [python: **/**.py] [jinja2: **/**.html] extensions=jinja2.ext.autoescape,jinja2.ext

Babel: compile translation files when calling setup.py install

☆樱花仙子☆ 提交于 2019-12-21 04:59:10
问题 I'm developing a Flask application using Babel. Thanks to Distutils/Setuptools Integration, all the parameters of compile/extract/... functions are stored in setup.cfg and compiling the i18n files is as easy as ./setup.py compile_catalog Great. Now I would like this to be done automatically when running ./setup.py install In make 's words, that would be letting install target depend on compile_catalog target. The context We store only translation ( .po ) files in the code repository.

Nodemon + babel restart the server multiple times

风流意气都作罢 提交于 2019-12-21 04:25:18
问题 In my package.json I have a start-script which I'm using for my dev enviroment. It looks like this: "scripts": { "dev": "NODE_PATH=src nodemon --watch src/ --exec babel-node src/app.js" } When I'm hitting npm run dev everything works fine and babel is transpiling everything as it should and nodemon starts watching. I see this: [nodemon] 1.11.0 [nodemon] to restart at any time, enter `rs` [nodemon] watching: /Users/Jonathan/Documents/swissnet/src/**/* [nodemon] starting `babel-node src/app.js`

How to compile all included files into one using Babel?

可紊 提交于 2019-12-21 03:55:26
问题 I am using Babel in my project. The thing is, I have this line of code in my server.js : import schema from "./data/schema"; ( data/schema.js is in ES2015 syntax). And when I am trying to compile my server.js with babel, like this: babel -o server_production.js --minified server.js it produces a new file without errors and replaces import instruction with require . But the thing is, when I am trying to run my babel-compiled server.js with node , it complains about data/schema.js , because it

babel polyfill being included, but forEach still doesn't work in IE11 on NodeLists

前提是你 提交于 2019-12-20 20:38:36
问题 I've got Webpack working with Babel and including the @babel/polyfill, yet IE11 is still throwing a SCRIPT438 error when trying to use .forEach on a NodeList . Here's my package.json { ... "scripts": { "build:js": "webpack --config ./_build/webpack.config.js" }, ... "browserslist": [ "IE 11", "last 3 versions", "not IE < 11" ], "babel": { "presets": [ [ "@babel/preset-env", { "useBuiltIns": "usage" } ] ] }, "devDependencies": { "@babel/core": "^7.1.6", "@babel/preset-env": "^7.1.6", "babel