-
Notifications
You must be signed in to change notification settings - Fork 14
/
schema.webpack.js
53 lines (50 loc) · 1.36 KB
/
schema.webpack.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
45
46
47
48
49
50
51
52
53
/* eslint-env node */
// Schema generation has client dependencies, to run it on the node we bundle it.
const path = require('path');
const TerserPlugin = require('terser-webpack-plugin');
const SRC_PATH = path.resolve('src');
const SCHEMA_SRC_PATH = path.resolve(SRC_PATH, 'schema');
const SCHEMA_RESULT_PATH = path.resolve(__dirname, 'schema');
const SCHEMA_BUNDLE_FILENAME = 'index.js';
module.exports = {
entry: path.resolve(SCHEMA_SRC_PATH, 'index.ts'),
output: {
path: SCHEMA_RESULT_PATH,
filename: SCHEMA_BUNDLE_FILENAME,
library: 'library',
libraryTarget: 'umd',
},
mode: 'production',
target: 'node',
module: {
rules: [
{
test: /\.[jt]sx?$/,
exclude: [/node_modules/],
use: {
loader: 'babel-loader',
},
},
{
test: /\.css$/,
use: 'null-loader',
},
],
},
resolve: {
extensions: ['.tsx', '.ts', '.js'],
},
optimization: {
minimize: true,
minimizer: [
new TerserPlugin({
extractComments: false,
terserOptions: {
format: {
comments: false,
},
},
}),
],
},
};