-
Notifications
You must be signed in to change notification settings - Fork 3
/
webpack.config.js
99 lines (85 loc) · 2.69 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
/* eslint-disable */
const webpack = require('webpack');
const Encore = require('@symfony/webpack-encore');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const FaviconsWebpackPlugin = require('favicons-webpack-plugin')
Encore
.setOutputPath('build/')
.setPublicPath('/')
.addEntry('app', './src/index.tsx')
.enableSingleRuntimeChunk()
.cleanupOutputBeforeBuild()
.enableSourceMaps(!Encore.isProduction())
// enables hashed filenames (e.g. app.abc123.css)
.enableVersioning(Encore.isProduction())
.configureCssLoader(config => {
if (Encore.isProduction()) {
config.modules.localIdentName = '[sha1:hash:hex:4]';
} else {
config.modules.localIdentName = '[name]__[local]--[sha1:hash:hex:4]';
}
})
.enableReactPreset()
.enableSassLoader()
.enableTypeScriptLoader()
;
const config = Encore.getWebpackConfig();
config.module.rules.push({
test: /\.(pdf)$/,
loader: 'file-loader',
options: {
name: 'assets/cv/[name].[ext]',
}
});
config.plugins.push(new HtmlWebpackPlugin({
template: 'src/app.html',
title: 'Raphaël Vigee',
meta: {
viewport: 'width=device-width, initial-scale=1, shrink-to-fit=no',
},
}));
config.plugins.push(
new webpack.DefinePlugin({
'process.env': {
CONTACT_FORM_URL: JSON.stringify(process.env.CONTACT_FORM_URL),
},
}),
);
config.plugins.push(new FaviconsWebpackPlugin({
// Your source logo
logo: `${__dirname}/src/assets/images/raccoon.png`,
// The prefix for all image files (might be a folder or a name)
prefix: 'icons-[hash]/',
// Emit all stats of the generated icons
emitStats: false,
// The name of the json containing all favicon information
statsFilename: 'iconstats-[hash].json',
// 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: 'transparent',
// favicon app title (see https://github.com/haydenbleasel/favicons#usage)
title: 'Raphaël Vigee',
// which icons should be generated (see https://github.com/haydenbleasel/favicons#usage)
icons: {
android: true,
appleIcon: true,
appleStartup: true,
coast: false,
favicons: true,
firefox: true,
opengraph: false,
twitter: false,
yandex: false,
windows: false
}
}));
config.plugins.push(
new webpack.WatchIgnorePlugin([
/scss\.d\.ts$/
]),
);
module.exports = config;