-
Notifications
You must be signed in to change notification settings - Fork 5
/
webpack.config.babel.js
65 lines (63 loc) · 1.75 KB
/
webpack.config.babel.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
import 'dotenv/config'
import FriendlyErrorsWebpackPlugin from 'friendly-errors-webpack-plugin'
import ProgressBarPlugin from 'progress-bar-webpack-plugin'
import WebpackNotifierPlugin from 'webpack-notifier'
import path from 'path'
import webpack from 'webpack'
const { GRAPHQL_ENDPOINT, NODE_ENV, PORT } = process.env
export default {
mode: NODE_ENV,
devtool: 'cheap-module-eval-source-map',
stats: 'errors-only',
entry: {
artworks: ['webpack-hot-middleware/client', './src/client.js'],
},
// externals: {
// graphql: 'graphql', // FIXME: 64:0-70:117 "export 'SourceLocation' was not found in './language'
// },
output: {
filename: '[name].js',
chunkFilename: '[name].bundle.js',
path: path.resolve(__dirname, 'public/assets'),
publicPath: '/assets',
},
module: {
rules: [
// See: https://github.com/aws/aws-amplify/issues/686#issuecomment-387710340
{
test: /\.mjs$/,
include: /node_modules/,
type: 'javascript/auto',
},
{
test: /\.js$/,
include: /src/,
loader: 'babel-loader',
options: {
cacheDirectory: true,
},
},
],
},
plugins: [
new FriendlyErrorsWebpackPlugin({
compilationSuccessInfo: {
messages: [`[App] Listening on http://localhost:${PORT} \n`],
},
}),
new ProgressBarPlugin(),
new WebpackNotifierPlugin(),
new webpack.DefinePlugin({
'process.env': {
GRAPHQL_ENDPOINT: JSON.stringify(GRAPHQL_ENDPOINT),
NODE_ENV: JSON.stringify(NODE_ENV),
},
}),
new webpack.HotModuleReplacementPlugin(),
new webpack.NoEmitOnErrorsPlugin(),
],
resolve: {
extensions: ['.mjs', '.js', '.jsx', '.json'],
modules: ['src', 'node_modules'],
},
}