Questions tagged [transpiler]

A transpiler is a compiler that translates the source code of one high-level programming language to the source code of another high-level programming language.

Transpilers are also known as compilers.

347 questions
134
votes
14 answers

Extending Error in Javascript with ES6 syntax & Babel

I am trying to extend Error with ES6 and Babel. It isn't working out. class MyError extends Error { constructor(m) { super(m); } } var error = new Error("ll"); var myerror = new MyError("ll"); console.log(error.message) //shows up…
Karel Bílek
  • 32,538
  • 28
  • 83
  • 137
121
votes
4 answers

Compiling vs Transpiling

While searching about the difference, I came across these definitions: Compiling is the general term for taking source code written in one language and transforming into another. Transpiling is a specific term for taking source code written in one…
Nishi Mahto
  • 1,333
  • 2
  • 8
  • 6
109
votes
2 answers

What is target in tsconfig.json for?

What does target in tsconfig.json signify? { "compilerOptions": { "sourceMap": true, "target": "es5", "module": "commonjs", "jsx": "react", "moduleResolution": "classic", "lib": [ "es2015", "dom", "es2017" ] } }
Ankit Raonka
  • 4,950
  • 8
  • 27
  • 48
49
votes
7 answers

Compiler vs Interpreter vs Transpiler

During a reactJS session that I was attending, the presenter used a term transpiler for some code conversion/porting happening. I've always used and heard the terms compiler and interpreter when it comes to converting a language code to a runnable…
RBT
  • 18,275
  • 13
  • 127
  • 181
44
votes
6 answers

Maintain src/ folder structure when building to dist/ folder with Typescript 3

I have a typescript nodejs server with this structure: tsconfig.json package.json src/ middleware/ utils/ index.ts dist/ middleware/ utils/ index.ts When using Typescript 2, I was able to transpile my project from the src/…
nfadili
  • 463
  • 1
  • 4
  • 8
29
votes
3 answers

Webpack with babel-loader not recognizing import keyword

I have this webpack.config.js: module.exports = { entry: './src/admin/client/index.jsx', output: { filename: './src/admin/client/static/js/app.js' }, loaders: [ { test: /\.jsx?$/, loader: 'babel', exclude:…
Jacob
  • 72,750
  • 22
  • 137
  • 214
26
votes
1 answer

Running a python function in BigQuery

Would it be possible to run a python function in BigQuery? It seems like C can be compiled to WebAssembly and run in BQ, per this blog post from Felipe. And of course Python can be compiled to C or C++ using cython or some other tools (or it could…
David542
  • 96,524
  • 132
  • 375
  • 637
25
votes
3 answers

Do I really need Babel or other transpilers to use ES6 with React?

Do I really need Babel or other transpilers to use ES6 in React? I was looking at the chart https://kangax.github.io/compat-table/es6/ Seems like my current browser Chrome (latest stable version) supports almost all the ES6 features... If I can use…
user3463521
  • 495
  • 1
  • 5
  • 16
24
votes
3 answers

How do I use ES6 (ES2015) in a ruby on rails app?

I have a 4.2 rails app and am considering slowly converting the JS to ES6. Right now I'm using the standard rails manifest file from the asset pipeline to pre-process my js. I'm not sure how to go about starting to use ES6 (adding a transpile step)…
pixelearth
  • 11,254
  • 8
  • 49
  • 87
24
votes
3 answers

What is the main difference between a Compiler and a Transpiler?

What are the main differences between a Compiler and a Transpiler? Please could you provide some examples of both?
Dawlatzai Ghousi
  • 2,965
  • 2
  • 15
  • 23
18
votes
1 answer

Prolog systems in Javascript

Javascript seems to become popular as an implementation language for other programming languages. The article Lightweight compilation of (C)LP to JavaScript. ICLP 2012 drew my attention on this. There are a lot of proof-of-concept prototypes for…
false
  • 10,182
  • 12
  • 93
  • 182
17
votes
2 answers

What will Typescript transpile when targeting ES5 / ES3?

I'm trying to understand when the Typescript compiler will transpile code to make it compatible with my specified target ECMAScript version (ES5 or ES3). For example, TSC will transpile for(var int of intArray) fine, but it doesn't transpile…
JoshMB
  • 940
  • 8
  • 14
17
votes
6 answers

Converting Python Code to PHP

Is there a software converter out there that can automatically convert this python code to PHP? #!/usr/bin/python import math def calcNumEntropyBits(s): if len(s) <= 0: return 0.0 symCount = {} for c in s: if…
Kirk Ouimet
  • 23,368
  • 41
  • 108
  • 164
14
votes
0 answers

Type safe RPC call example from GHCJS client to Yesod/Snap/Servant

I have two, related questions about RPC call to Yesod/Snap/Servant: Say I have a function on the server, written in Haskell, compiled by GHC: add x y = x+y+42 How can: I call this function from the client (the client is also written in Haskell,…
jhegedus
  • 18,516
  • 11
  • 84
  • 147
13
votes
2 answers

TypeScript via tsc command: Output to single file without concatenation

Is there a way of compiling single .ts file to different directory? The only way from the manual command of compilation to different directory is via --out command, but it also does concatenation of dependent files, which I don't want: --out…
Vojtěch
  • 9,438
  • 25
  • 81
  • 138
1
2 3
23 24