-
Notifications
You must be signed in to change notification settings - Fork 2
/
webpack.config.js
138 lines (121 loc) · 3.94 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
var webpack = require('webpack')
var postcss = require('postcss')
var autoprefixer = require('autoprefixer')
var cssnano = require('cssnano')
var ExtractTextPlugin = require("extract-text-webpack-plugin")
var BrowserSyncPlugin = require('browser-sync-webpack-plugin')
var path = require('path')
var WebpackPwaManifest = require('webpack-pwa-manifest')
var postcssSetup = {
plugins: () => {return [
autoprefixer({browsers: 'last 3 versions'}),
cssnano(),
]}
}
module.exports = {
entry: {
main: './src/main.js',
// vendor: './src/vendor.js',
// admin: './src/admin.js',
},
// Here the application starts executing
// and webpack starts bundling
output: {
path: path.resolve(__dirname, 'dist'), // string
filename: "[name].js", // string
publicPath: '../../dist/', // string
},
module: {
// configuration regarding modules
rules: [
//{ test: /\.js$/, loader: 'source-map', enforce: 'pre' },
{ test: /\.html$/, loader: ['riotjs'], enforce: 'pre' },
{ test: /\.js|\.html$/, loader: 'babel', options: { presets: ['es2015-riot', 'es2017', 'es2016', 'stage-2'] }},
{ test: /\.(jpe?g|png|gif|svg)$/i, loader: 'file', options: {name: 'images/[name].[ext]'}},
{ test: /\.(ttf|woff|eot)$/, loader: `file`, options: {name:'fonts/[name].[ext]'}},
{
test: /\.less$/, use: ExtractTextPlugin.extract(
[
//{loader:'raw'},
{loader:'css'},
{loader:'postcss', options: postcssSetup},
{loader:'less'}
]
),
},
{
test: /\.scss$/, use: ExtractTextPlugin.extract(
[
//{loader:'raw'},
{loader:'css'},
{loader:'postcss', options: postcssSetup},
{loader:'sass'}
]
),
},
{
test: /\.css$/, use: ExtractTextPlugin.extract(
[
{loader:'css'},
{loader:'postcss', options: postcssSetup},
]
),
}
],
},
resolveLoader: {
moduleExtensions: ["-loader"]
},
plugins: [
new ExtractTextPlugin("css/[name].css"),
new webpack.ProvidePlugin({
riot: 'riot',
// route: 'riot-route',
regeneratorRuntime: 'regenerator-runtime'
}),
new BrowserSyncPlugin({
// browse to http://localhost:3000/ during development,
// ./public directory is being served
host: 'localhost',
port: 3000,
files: ['**/*.php', '*.php'],
//server: { baseDir: ['public'] }
proxy: 'http://localhost/'
}),
new WebpackPwaManifest({
fingerprints: false,
name: 'SSF - Die Südstaaten Furs',
short_name: 'südstaatenfurs',
description: 'Alles um Events für Furries im Raum Baden-Württemberg und Umgebung',
background_color: '#F9C842',
icons: [
{
src: path.resolve('src/images/logo.png'),
sizes: [96, 128, 192, 256, 384, 512] // multiple sizes
}
]
})
// new webpack.optimize.UglifyJsPlugin({
// output: {
// "ascii_only": true
// }
// })
],
devtool: "source-map", // enum
context: __dirname, // string (absolute path!)
target: "web", // enum
stats: { //object
assets: true,
colors: true,
errors: true,
//errorDetails: true,
//hash: true,
},
devServer: {
contentBase: path.join(__dirname, ''), // boolean | string | array, static file location
compress: true, // enable gzip compression
historyApiFallback: true, // true for index.html upon 404, object for multiple paths
https: false, // true for self-signed, object for cert authority
// ...
},
}