forked from Devographics/state-of-js-graphql-results-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.common.js
44 lines (43 loc) · 1.23 KB
/
webpack.common.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
const path = require('path')
const nodeExternals = require('webpack-node-externals')
const WriteFilePlugin = require('write-file-webpack-plugin')
const CopyWebpackPlugin = require('copy-webpack-plugin')
module.exports = {
entry: {
server: path.join(__dirname, 'src/server.ts'),
standalone: path.join(__dirname, 'src/standalone.ts')
},
module: {
rules: [
{
test: /\.yml$/,
exclude: /node_modules/,
use: 'js-yaml-loader'
},
{
test: /\.graphql$/,
exclude: /node_modules/,
use: 'graphql-tag/loader'
},
{
test: /\.ts$/,
exclude: /node_modules/,
use: 'ts-loader'
}
]
},
output: {
filename: '[name].js',
path: path.resolve(__dirname, 'dist')
},
resolve: {
extensions: ['.ts', '.js', '.yml', '.graphql']
},
externals: [nodeExternals({})],
target: 'node',
node: false,
plugins: [
new WriteFilePlugin(),
new CopyWebpackPlugin({ patterns: [{ from: path.join(__dirname, 'public'), to: path.join(__dirname, 'dist/public') }] })
]
}