babeljs

How do I modify the node startup command in Open Shift?

这一生的挚爱 提交于 2020-01-04 06:52:49
问题 I'm using ES6 with babel-node to create my app and I require my app to start with the command babel-node app.js . This command is listed in scripts: start in my package.json so the command npm start runs the correct command. Open shift starts node apps with node + what ever script is set in the main property of your package.json file. In my case its "main": "app.js" . So this command is run node app.js . The server is choking on the first ES6 it encounters which makes sense. I can't figure

How do I modify the node startup command in Open Shift?

喜欢而已 提交于 2020-01-04 06:51:20
问题 I'm using ES6 with babel-node to create my app and I require my app to start with the command babel-node app.js . This command is listed in scripts: start in my package.json so the command npm start runs the correct command. Open shift starts node apps with node + what ever script is set in the main property of your package.json file. In my case its "main": "app.js" . So this command is run node app.js . The server is choking on the first ES6 it encounters which makes sense. I can't figure

What is the correct syntax for importing JSNLog using ES6?

我是研究僧i 提交于 2020-01-04 02:45:29
问题 I can't seem to figure out how to import JSNLog into my ES6 (babel) based Aurelia project. I've tried: import 'jsnlog'; // JL is undefined import JL from 'jsnlog'; // JL is {} import {JL} from 'jsnlog'; // JL is undefined If it matters I've learned that the jsnlog.js file is generated from typescript source. 回答1: The author has fixed this issue with the v2.17.1 release. 回答2: I am the author of JSNLog. Just added info to the jsnlog.com site about using ES6 import to import JSNLog into an ES6

How to transpile a Relay query from TypeScript to ES5?

自闭症网瘾萝莉.ら 提交于 2020-01-04 02:19:08
问题 I'm writing a web app in TypeScript. The app uses React and Relay from Facebook. My TypeScript source code gets compiled into ES6 code using the TypeScript compiler TSC. Then, the ES6 code gets transpiled into ES5 code using Babel. In order for Relay to work in the browser, a Babel plugin needs to transform the Relay GraphQL queries: https://facebook.github.io/relay/docs/guides-babel-plugin.html. The problem is, because TSC first transpiles these queries, the Babel Relay plugin doesn't

Vue-jest can't find babel

给你一囗甜甜゛ 提交于 2020-01-04 01:07:20
问题 I'm trying to test my vue components however I'm always getting the following error: Cannot find module 'babel-core' at Object. (node_modules/vue-jest/lib/compilers/babel-compiler.js:1:15) package.json: "devDependencies": { "@babel/core": "^7.2.2", "@babel/plugin-syntax-dynamic-import": "^7.2.0", "@babel/preset-env": "^7.3.1", "@vue/test-utils": "^1.0.0-beta.29", "babel-jest": "^24.1.0", "babel-loader": "^8.0.5", "css-loader": "^2.1.0", "file-loader": "^3.0.1", "jest": "^24.1.0", "mini-css

Vue-jest can't find babel

偶尔善良 提交于 2020-01-04 01:06:30
问题 I'm trying to test my vue components however I'm always getting the following error: Cannot find module 'babel-core' at Object. (node_modules/vue-jest/lib/compilers/babel-compiler.js:1:15) package.json: "devDependencies": { "@babel/core": "^7.2.2", "@babel/plugin-syntax-dynamic-import": "^7.2.0", "@babel/preset-env": "^7.3.1", "@vue/test-utils": "^1.0.0-beta.29", "babel-jest": "^24.1.0", "babel-loader": "^8.0.5", "css-loader": "^2.1.0", "file-loader": "^3.0.1", "jest": "^24.1.0", "mini-css

Webpack getting started, import error

僤鯓⒐⒋嵵緔 提交于 2020-01-03 20:49:46
问题 I'm getting started with Webpack, but already ran into the following problem: I created an app/index.js file (as specified in the documentation). I also created an index.html file (copied the HTML and CSS from the documentation). I ran the correct commands in the CLI (including generating a dist/bundle.js file). The code: <!DOCTYPE html> <html lang="nl"> <head> <meta charset="UTF-8"> <title>Webpack</title> <!-- <script src="https://unpkg.com/lodash@4.16.6" type="text/javascript"></script> -->

Babel: Replacing ArrowFunctionExpression vs FunctionDeclaration in ExportDefaultDeclaration

走远了吗. 提交于 2020-01-03 19:31:34
问题 Say I have the following code I want to transform: export default () => {}; The following visitor code works: export default function ({ types: t }) { return { visitor: { ArrowFunctionExpression(path) { if (!path.node.body.directives.some(d => d.value.value === 'inject')) return; path.node.body.directives = path.node.body.directives.filter(d => d.value.value !== 'inject'); path.replaceWith(t.arrayExpression([path.node])); } } }; } That results in the following output: export default [() => {}

Babel: Replacing ArrowFunctionExpression vs FunctionDeclaration in ExportDefaultDeclaration

一世执手 提交于 2020-01-03 19:31:10
问题 Say I have the following code I want to transform: export default () => {}; The following visitor code works: export default function ({ types: t }) { return { visitor: { ArrowFunctionExpression(path) { if (!path.node.body.directives.some(d => d.value.value === 'inject')) return; path.node.body.directives = path.node.body.directives.filter(d => d.value.value !== 'inject'); path.replaceWith(t.arrayExpression([path.node])); } } }; } That results in the following output: export default [() => {}

Webpack 4 + Babel leaving const in transpiled code

若如初见. 提交于 2020-01-03 16:42:58
问题 I'm trying to get my code working on Android 4.1 Webview, which doesn't support ES6. But I am getting this error: Uncaught SyntaxError: Use of const in strict mode. .babelrc config { "plugins": [ "lodash" ], "presets": [ "@babel/preset-react", [ "@babel/preset-env", { "targets": { "android": "4.1" }, "useBuiltIns": "usage", "forceAllTransforms": true } ], "@babel/preset-stage-0" ] } webpack.config.js rules: [ { enforce: 'pre', test: /\.jsx?$/, exclude: /node_modules/, loader: "eslint-loader"