This repository has been archived by the owner on Dec 26, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.config.js
68 lines (63 loc) · 1.63 KB
/
webpack.config.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
const path = require("path");
const RelayCompilerWebpackPlugin = require('relay-compiler-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const webpack = require('webpack');
const config = {
devtool: 'cheap-eval-source-map',
entry: ['@babel/polyfill', './frontend/src/entry.js'],
output: {
path: path.resolve(__dirname, 'dist'),
filename: '[name]-[hash].js'
},
module: {
rules: [
{
test: /\.(ttf|eot|otf|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
use: [
{loader: "file-loader"}
]
},
{
test: /\.(gif|png|jpg)$/,
use: [
{loader: "url-loader?mimetype=image/png"}
]
},
{
test: /\.css$/,
use: [
{loader: "style-loader"},
{loader: "css-loader"},
{loader: "autoprefixer-loader?browsers=last 10 versions"}
]
},
{
test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/,
use: [
{loader: "url-loader?limit=464600&minetype=application/font-woff"}
]
},
{
test: /\.js$/,
exclude: path.join(__dirname, 'node_modules'),
use: [
{loader: "babel-loader"}
]
}
]
},
plugins: [
new HtmlWebpackPlugin({
template: path.join(__dirname, 'frontend', 'src', 'index.html')
}),
new RelayCompilerWebpackPlugin({
schema: path.resolve(__dirname, './data/schema.json'),
//schema: require('./backend/src/schema'),
src: path.resolve(__dirname, './frontend/src'),
})
],
}
if (webpack.version >= '4') {
config.mode = 'development'
}
module.exports = config