-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
62 lines (59 loc) · 1.49 KB
/
webpack.config.js
File metadata and controls
62 lines (59 loc) · 1.49 KB
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
54
55
56
57
58
59
60
61
62
const path = require('path');
const CopyPlugin = require('copy-webpack-plugin');
const Dotenv = require('dotenv-webpack');
module.exports = {
context: path.resolve(__dirname, './src'),
entry: {
graphiql: './graphiql.js',
voyager: './voyager.js',
},
output: {
filename: '[name].js',
path: path.resolve(__dirname, '../dist'),
},
module: {
rules: [
{
test: /\.(js)$/,
exclude: /node_modules/,
use: [
{
loader: 'babel-loader',
options: {
presets: [
['@babel/preset-env', { targets: { esmodules: true } }],
'@babel/preset-react',
// 'module:metro-react-native-babel-preset',
// 'module:react-native-dotenv',
],
},
},
],
},
{
test: /\.css$/,
use: ['style-loader', 'css-loader'],
},
],
},
plugins: [
new Dotenv(),
new CopyPlugin({
patterns: [
{ from: '*.html' },
{ from: '../node_modules/graphiql/graphiql.css' },
{ from: '../node_modules/graphql-voyager/dist/voyager.css' },
{ from: '../node_modules/graphql-voyager/dist/voyager.worker.js' },
],
}),
],
optimization: {
minimize: false,
},
devServer: {
hot: true,
// bypass simple localhost CORS restrictions by setting
// these to 127.0.0.1 in /etc/hosts
allowedHosts: ['local.test.com', 'locahost', 'github.com', 'graphiql.com'],
},
};