-
Notifications
You must be signed in to change notification settings - Fork 25
/
webpack.shared.js
76 lines (73 loc) · 1.76 KB
/
webpack.shared.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
69
70
71
72
73
74
75
76
const webpack = require('webpack');
const FaviconsWebpackPlugin = require('favicons-webpack-plugin');
const CleanWebpackPlugin = require('clean-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const DefinePlugin = require('webpack/lib/DefinePlugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const SITE_CONFIG = require(process.env.GEOTIFF_IO_CONFIG || './config.json');
console.log("SITE_CONFIG:", SITE_CONFIG);
const globalVars = SITE_CONFIG.colors;
globalVars['logo-dark'] = SITE_CONFIG.logo.dark;
globalVars['logo-light'] = SITE_CONFIG.logo.light;
module.exports = {
entry: [
'babel-polyfill',
'./src/index.js'
],
resolve: {
modules: ['node_modules', 'src'],
extensions: ['.js', '.json']
},
module: {
rules: [{
test: /\.less$/,
use: [
"style-loader",
"css-loader",
{
loader: "less-loader",
options: {
globalVars
}
}
]
},
{
test: /\.js$/,
exclude: /node_modules/,
use: "babel-loader",
}
]
},
plugins: [
new CleanWebpackPlugin(['docs']),
new CopyWebpackPlugin([{
from: './assets/images',
to: 'images'
},
{
from: './assets/favicon.png',
to: 'favicon.png'
},
{
from: './404.html',
to: '404.html'
},
{
from: './sitemap.xml',
to: 'sitemap.xml'
}
]),
new DefinePlugin({
'SITE_CONFIG': JSON.stringify(SITE_CONFIG)
}),
new FaviconsWebpackPlugin('./assets/favicon.png'),
new HtmlWebpackPlugin({
template: 'index.html',
templateParameters: {
SITE_CONFIG
},
title: SITE_CONFIG.title
})
],
}