-
Notifications
You must be signed in to change notification settings - Fork 5
/
webpack.config.js
64 lines (61 loc) · 2.03 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
var path = require('path');
var fs = require('fs');
var webpack = webpack = require('webpack');
var IS_PRODUCTION = process.env.NODE_ENV == 'production';
var SRC_DIRECTORY = path.resolve(__dirname, 'src');
module.exports = {
output: {
path: path.resolve(__dirname, "build", "web"),
filename: "[name].js",
publicPath: IS_PRODUCTION ? undefined : process.env.ASSET_BASE_URL+"/",
},
devtool: IS_PRODUCTION ? 'source-map' : 'inline-source-map',
entry: {
"js/dashboard/index": './src/web/js/dashboard/index.js',
"js/beforePyret": './src/web/js/beforePyret.js',
"js/beforeBlocks": './src/web/js/beforeBlocks.js',
},
module: {
rules: [
{test: /\.css$/, loaders: ["style-loader", "css-loader"]},
{test:/.png|.jpg|.jpeg|.gif|.svg/, loader: "url-loader?limit=10000"},
{
test: /\.js$/,
enforce: "pre",
include: [
SRC_DIRECTORY,
],
loader: "babel-loader",
query: {
cacheDirectory: true
}
}]
},
resolve: {
modules: [__dirname, 'node_modules'],
alias: { },
},
plugins: [
new webpack.DefinePlugin({
'process.env.FIREBASE_API_KEY': JSON.stringify(process.env.FIREBASE_API_KEY),
'process.env.FIREBASE_AUTH_DOMAIN': JSON.stringify(process.env.FIREBASE_AUTH_DOMAIN),
'process.env.FIREBASE_DB_URL': JSON.stringify(process.env.FIREBASE_DB_URL),
'process.env.FIREBASE_BUCKET': JSON.stringify(process.env.FIREBASE_BUCKET),
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV),
'process.env.PYRET': JSON.stringify(process.env.PYRET),
'process.env.PYRET_BACKUP': JSON.stringify(process.env.PYRET_BACKUP),
'process.env.BASE_URL': JSON.stringify(process.env.BASE_URL),
'process.env.CURRENT_PYRET_RELEASE': JSON.stringify(process.env.CURRENT_PYRET_RELEASE),
}),
],
optimization: { minimize: IS_PRODUCTION },
devServer: IS_PRODUCTION ? {} : {
inline: true,
port: 5001,
proxy: {
"/**": {
target: 'http://localhost:5000',
}
}
},
};