ts-runtime loader for webpack
yarn add ts-runtime-loader
or
npm install ts-runtime-loader
You will also need to install TypeScript if you have not already.
yarn add typescript
or
npm install typescript
- Create or update
webpack.config.js
like so:
module.exports = {
mode: "development",
devtool: "inline-source-map",
entry: "./app.ts",
output: {
filename: "bundle.js"
},
resolve: {
extensions: [".ts", ".js"]
},
module: {
rules: [
// ts-runtime-loader must be before ts-loader.
{ test: /\.runtime\.ts$/, loader: "ts-runtime-loader" },
{ test: /\.ts$/, loader: "ts-loader" },
]
}
};