This repository was archived by the owner on Aug 20, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
63 lines (59 loc) · 1.42 KB
/
webpack.config.js
File metadata and controls
63 lines (59 loc) · 1.42 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
63
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const pkg = require('./package.json');
const webpack = require('webpack');
var API_URL = {
production: JSON.stringify('https://app.kotkt.nl'),
development: JSON.stringify('http://localhost:8000')
};
// check environment mode
var environment = process.env.NODE_ENV === 'production' ? 'production' : 'development';
module.exports = {
entry: path.resolve(__dirname, './src/main.jsx'),
output: {
path: path.resolve(__dirname, 'build/'),
filename: 'script.js',
},
resolve: {
extensions: ['', '.js', '.jsx', '.css'],
},
devServer: {
contentBase: path.resolve(__dirname, 'app'),
},
devtool: 'source-map',
module: {
loaders: [
{
test: /\.jsx?$/,
loader: 'babel',
exclude: /node_modules/,
},
{
test: /\.json$/,
loader: 'json',
},
{
test: /\.css$/,
loaders: ['style', 'css'],
},
{
test: /\.(eot|gif|jpe?g|png|svg|ttf|woff2?)(\?.*)?$/,
loaders: ['file'],
},
],
},
externals: {
// Workaround for https://github.com/airbnb/enzyme/issues/47
'react/addons': true,
'react/lib/ExecutionEnvironment': true,
'react/lib/ReactContext': true,
},
plugins: [
new HtmlWebpackPlugin({
title: pkg.name
}),
new webpack.DefinePlugin({
'API_URL': API_URL[environment]
})
]
};