transpiler

Client-side JSX transpiling

元气小坏坏 提交于 2019-12-11 14:10:35
问题 I want to create React applications with JSX and not have to use a terminal or any server-side/dev environment commands. The environment we are using doesn't allow for commands to be run in the dev environment and these applications will be purely statically hosted on a CDN. So I know I can simply include Babel's browser.js to do the JSX transpiling in the browser. Perfect. My concern is that Babel apparently stopped supporting this and modern versions of Babel have it removed. Is there

How do I generate a sourcemap with babel using this directory structure?

廉价感情. 提交于 2019-12-11 12:13:22
问题 gulp.task('build:server:js', function(){ return gulp.src("server/**/*.js") .pipe(sourcemaps.init()) .pipe(babel({ "presets": ["es2015", "react", "stage-0"] })) .pipe(sourcemaps.write('.', { includeContent: false, sourceRoot: function(file) { var from = file.path; var to = path.resolve(__dirname+'/../server'); var dest = path.relative(from, to) + '/../server'; console.log("from %s\nto: %s\ndest: %s\n", from, to, dest); return dest; } })) .pipe(gulp.dest("dist/server/")); }); gulp tasks are in

Webpack modules distribution along output files

旧城冷巷雨未停 提交于 2019-12-11 09:05:29
问题 I'm new to Webpack and Babel, but I think I've quite understood how to use them, even though, there is still one thing I haven't been able to solve. Here is the problem... Essentially, I have 3 javascript files: setup.js loader.js main.js setup.js is the only file linked to my html pages, it contains a lightweight script which dynamically inserts some needed resources, including loader.js loader.js is a bit heavier, and is responsible of downloading and inserting all the remaining resources,

Why does the typescript transpiler not hoist variables?

别等时光非礼了梦想. 提交于 2019-12-10 11:25:35
问题 I understand that ES6 and TypeScript both support block level scoping, but when targeting ES3 and ES5 the output should be function level scoping. I think there has to be a logic behind why TypeScript isn't hoisting variables.. and I'm not running into a problem, I'm more just curious why it doesn't hoist variables. For example, given the following TypeScript: function seed(length: number, multiplier: number): number[] { let result: number[] = []; for(let i: number = 0; i < length; i++) { let

Using tasks.json in Visual Studio Code to transpile both typescript and sass

天大地大妈咪最大 提交于 2019-12-07 22:26:08
问题 I want to transpile both typescript and sass to javascript and css respectively. At The moment running this tasks.json file transpiles my typescript to javascript: { "version": "0.1.0", // The command is tsc. Assumes that tsc has been installed using npm install -g typescript "command": "tsc", // The command is a shell script "isShellCommand": true, // Show the output window only if unrecognized errors occur. "showOutput": "silent", // args is the HelloWorld program to compile. "args": [

How to make a vuejs application work with IE 11 when using feathersjs

房东的猫 提交于 2019-12-06 17:52:29
When creating a standard vue app (using vue-cli v3.0) and including @feathersjs/feathers in order to implement a connection with a feathers API, I get an error with Internet Explorer 11 ( SCRIPT1010: Expected identifier ) The bottom line is to find an easy way to solve issues like this, because on bigger projects one could easily find lots of library issues and sometimes is necessary to support at least one version of Internet Explorer (at least from the business point of view) I read on feathers site ( https://docs.feathersjs.com/api/client.html#module-loaders ) that the library uses ES6 so

How to write a Typescript plugin?

ぃ、小莉子 提交于 2019-12-06 15:21:45
Are there any docs / examples of writing a Typescript plugin? For the last time I am very inspired with the idea of bringing Typescript into my projects. However, currently I see this is not possible because of my failed attempts to find any docs about writing a Typescript plugin . I need this plugin for combining classes metadata during compilation and then generating an asset. It was not that easy but I've already written such for babel and now I am interested if it is possible to do the same with Typescript. You can download https://github.com/microsoft/typescript or via npm. npm install

Using tasks.json in Visual Studio Code to transpile both typescript and sass

左心房为你撑大大i 提交于 2019-12-06 10:25:12
I want to transpile both typescript and sass to javascript and css respectively. At The moment running this tasks.json file transpiles my typescript to javascript: { "version": "0.1.0", // The command is tsc. Assumes that tsc has been installed using npm install -g typescript "command": "tsc", // The command is a shell script "isShellCommand": true, // Show the output window only if unrecognized errors occur. "showOutput": "silent", // args is the HelloWorld program to compile. "args": ["public/app/boot.ts"], // use the standard tsc problem matcher to find compile problems // in the output.

Why does the typescript transpiler not hoist variables?

六月ゝ 毕业季﹏ 提交于 2019-12-06 09:44:00
I understand that ES6 and TypeScript both support block level scoping, but when targeting ES3 and ES5 the output should be function level scoping. I think there has to be a logic behind why TypeScript isn't hoisting variables.. and I'm not running into a problem, I'm more just curious why it doesn't hoist variables. For example, given the following TypeScript: function seed(length: number, multiplier: number): number[] { let result: number[] = []; for(let i: number = 0; i < length; i++) { let n: number = i * multiplier; result.push(n); } return result; } The transpiler outputs: function seed

TypeScript should assign to `this` before `_super` call in transpiled output for ES5?

丶灬走出姿态 提交于 2019-12-05 19:57:46
I use dependency injection for all my child classes that extends an abstract class. The problem that in abstract constructor class I launch a method that I planned to override in its children, if necessary. I stuck in problem that my injected dependency is not visible in my override class that is launched from super. Here is an example of code: abstract class Base { constructor(view: string) { this._assemble(); } protected _assemble(): void { console.log("abstract assembling for all base classes"); } } class Example extends Base { constructor(view: string, private helper: Function) { super