-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
46 lines (44 loc) · 1.4 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
const path = require('path');
const webpack = require('webpack');
const HtmlWebPackPlugin = require('html-webpack-plugin');
const config = require('./config');
module.exports = (env, options) => {
const product = process.env.PRODUCT || 'ttd';
const currentConfig = config[product];
return {
entry: './src/index.js',
output: {
filename: `${product}.js?[hash]`,
path: path.resolve(__dirname, `docs/${product}`),
},
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
},
},
],
},
plugins: [
new HtmlWebPackPlugin({
template: './src/index.html',
filename: './index.html',
}),
new webpack.DefinePlugin({
PRODUCTION: JSON.stringify(options.mode === 'production'),
FB_APIKEY: JSON.stringify(currentConfig.firebase.apiKey),
FB_AUTHDOMAIN: JSON.stringify(currentConfig.firebase.authDomain),
FB_DATABASEURL: JSON.stringify(currentConfig.firebase.databaseURL),
FB_PROJECTID: JSON.stringify(currentConfig.firebase.projectId),
FB_STORAGEBUCKET: JSON.stringify(currentConfig.firebase.storageBucket),
FB_MESSAGINGSENDERID: JSON.stringify(
currentConfig.firebase.messagingSenderId,
),
QUESTIONSPERDAY: JSON.stringify(currentConfig.questionsPerDay),
}),
],
};
};