-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
executable file
·140 lines (136 loc) · 3.6 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
const path = require('path')
const webpack = require('webpack')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const FaviconsWebpackPlugin = require('favicons-webpack-plugin')
const ExtractTextPlugin = require('extract-text-webpack-plugin')
const isProduction = process.argv.indexOf('-p') > -1
const port = process.env.PORT || 80
const host = process.env.HOST || '127.0.0.1'
module.exports = {
entry: [
'babel-polyfill',
path.resolve(__dirname, './src/scripts/main.js')
],
output: {
path: path.resolve(__dirname, './dist'),
publicPath: './',
filename: 'mudora.js'
},
cache: true,
module: {
rules: [
{
test: /\.jsx?$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
cacheDirectory: true
}
}
},
{
test: /global.css$/,
use: ExtractTextPlugin.extract({
use: [
{loader: 'css-loader', options: {sourceMap: true}},
{loader: 'postcss-loader', options: {sourceMap: true}}
],
fallback: 'style-loader'
})
},
{
test: /^((?!global).)*\.css$/,
use: ExtractTextPlugin.extract({
use: [
{
loader: 'css-loader',
options: {
modules: true,
sourceMap: true,
importLoaders: 1,
localIdentName: '[name]__[local]'
}
},
{loader: 'postcss-loader', options: {sourceMap: true}}
]
})
},
{
test: /\.(png|svg)$/,
loader: 'file-loader',
query: {
context: 'src',
name: '[path][name].[ext]'
}
}
]
},
resolve: {
extensions: ['.js', '.css']
},
devtool: 'source-map',
devServer: {
compress: true,
noInfo: true,
stats: 'errors-only',
inline: true,
lazy: false,
watchOptions: {
aggregateTimeout: 300,
poll: 100
},
https: true,
port,
host,
publicPath: `https://${host}:${port}`
},
plugins: [
new FaviconsWebpackPlugin({
// Your source logo
logo: './src/favicon/master.png',
// The prefix for all image files (might be a folder or a name)
prefix: 'img/favicon/',
// Emit all stats of the generated icons
emitStats: false,
// Generate a cache file with control hashes and
// don't rebuild the favicons until those hashes change
persistentCache: true,
// Inject the html into the html-webpack-plugin
inject: true,
// favicon background color (see https://github.com/haydenbleasel/favicons#usage)
background: '#fff',
// favicon app title (see https://github.com/haydenbleasel/favicons#usage)
title: 'Zelda\'s Letter'
}),
new HtmlWebpackPlugin({
inject: false,
template: require('html-webpack-template'),
title: 'Zelda\'s Letter',
filename: 'index.html',
hash: true,
appMountId: 'react-container',
appMountHtmlSnippet: '<noscript>Please enable JavaScript to use Zelda\'s Letter</noscript>',
meta: [
{
name: 'description',
content: 'View and edit ocarina of time dialogs'
}
],
mobile: true,
lang: 'en-US',
links: [
'https://fonts.googleapis.com/css?family=Roboto:400,700'
]
}),
new ExtractTextPlugin({
filename: 'mudora.css',
allChunks: true
}),
new webpack.DefinePlugin({
'process.env': {
'NODE_ENV': JSON.stringify(isProduction ? 'production' : 'development')
}
})
]
}