Skip to content

Instantly share code, notes, and snippets.

@isNotOkay
Created March 15, 2019 07:35
Show Gist options
  • Save isNotOkay/6e36ed3e69614dc843cf787f827a5c11 to your computer and use it in GitHub Desktop.
Save isNotOkay/6e36ed3e69614dc843cf787f827a5c11 to your computer and use it in GitHub Desktop.
Bundling a gRPC application written in Typescript with Webpack
const path = require('path');
const nodeExternals = require('webpack-node-externals');
const {TsConfigPathsPlugin} = require('awesome-typescript-loader');
module.exports = {
mode: 'development',
entry: './src/index.ts',
target: 'node',
// ignore node_modules when bundling with webpack
externals: [nodeExternals()],
devtool: 'inline-source-map',
node: {
__filename: true,
__dirname: true
},
module: {
rules: [
{
loader: 'ts-loader',
test: /\.ts$/,
exclude: [
/node_modules/
],
options: {
configFile: 'tsconfig.json'
}
}
]
},
resolve: {
plugins: [
new TsConfigPathsPlugin()
],
extensions: ['.ts', '.js']
},
output: {
filename: 'index.js',
path: path.resolve(__dirname, './dist')
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment