Transpilers, a.k.a. source-to-source compilers are tools that read source code written in one language and produce the equivalent code in another language
Typescript
class Car {
ps: number;
constructor(ps: number) {
this.ps = ps;
}
drive() {
console.log(`Car with ${this.ps} is driving.`);
}
}
to JavaScript (ES5)
var Car = (function () {
function Car(ps) {
this.ps = ps;
}
Car.prototype.drive = function () {
console.log("Car with " + this.ps + " is driving.");
};
return Car;
}());
The most commonly used transpiler by far is Babel 👉🏼
A loader in Webpack can preprocess files. This allows you to bundle any static resource even beyond JavaScript.
module.exports = {
module: {
rules: [
{
test: /\.md$/,
use: [
loader: "markdown-loader",
options: {}
]
}
]
}
}
The webpack documentation has a good chapter to see different loaders in action: Loaders.
See the README.md for more information
Popular framework CLIs do all the initial setup for you.
Popular framework CLIs do all the initial setup for you.