Created
May 29, 2020 03:24
-
-
Save Wonder2210/ee0c1be1a9d3e3ff34f6d067d6b52beb to your computer and use it in GitHub Desktop.
Webpack config for Graphql + Typescript
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 {CheckerPlugin} = require('awesome-typescript-loader'); | |
var nodeExternals = require('webpack-node-externals'); | |
module.exports = { | |
mode: 'production', | |
entry: './src/index.ts', | |
target:'node', | |
externals: [nodeExternals(),{ knex: 'commonjs knex' }], | |
output: { | |
path: path.resolve(__dirname, 'dist'), | |
filename: 'bundle.js' | |
}, | |
resolve: { | |
extensions: [ ".mjs",'.js', '.ts','.(graphql|gql)'], | |
modules: [ | |
'src', | |
] | |
}, | |
module:{ | |
rules:[ | |
{ | |
test: /\.(graphql|gql)$/, | |
exclude: /node_modules/, | |
loader: 'graphql-tag/loader' | |
}, | |
{ | |
test: /\.ts$/, | |
exclude: /node_modules/, | |
loaders: 'awesome-typescript-loader' | |
} | |
] | |
}, | |
plugins:[ | |
new CheckerPlugin(), | |
] | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment