Created
March 15, 2019 07:35
-
-
Save isNotOkay/6e36ed3e69614dc843cf787f827a5c11 to your computer and use it in GitHub Desktop.
Bundling a gRPC application written in Typescript with Webpack
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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