forked from FreeFeed/freefeed-react-client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.babel.js
81 lines (78 loc) · 2.06 KB
/
webpack.config.babel.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
import HtmlWebpackPlugin from 'html-webpack-plugin';
import OptiCSS from 'optimize-css-assets-webpack-plugin';
import MiniCssExtractPlugin from 'mini-css-extract-plugin';
import Uglify from 'terser-webpack-plugin';
import CopyPlugin from 'copy-webpack-plugin';
import ESLintPlugin from 'eslint-webpack-plugin';
import { baseConfig, opts, rules } from './webpack/base';
import { skipFalsy } from './webpack/utils';
const config = {
...baseConfig,
entry: {
app: skipFalsy(['core-js/stable', 'regenerator-runtime/runtime', 'whatwg-fetch', './src']),
bookmarklet: skipFalsy(['./src/bookmarklet/popup.js']),
config: skipFalsy(['./config/lib/loader-browser.js']),
},
target: 'web',
devServer: { historyApiFallback: true },
module: {
rules: skipFalsy([
opts.dev && rules.eslint,
rules.babel,
rules.css,
rules.cssModule,
rules.assetsCss,
rules.template,
rules.fonts,
rules.photoswipe,
rules.markdown,
rules.otherAssets,
]),
},
plugins: skipFalsy([
...baseConfig.plugins,
new ESLintPlugin({
extensions: ['js', 'jsx'],
files: ['src', 'test'],
lintDirtyModulesOnly: true,
}),
new HtmlWebpackPlugin({
inject: false,
template: './index.jade',
file: 'index.html',
appConfig: global.CONFIG,
opts,
}),
new MiniCssExtractPlugin({
filename: opts.hash ? '[name]-[contenthash].css' : '[name]-dev.css',
}),
new CopyPlugin({
patterns: [
{ from: 'assets/images/favicon.*', to: '' },
{ from: 'assets/images/ios/*.png', to: '' },
{ from: 'assets/ext-auth/auth-return.html', to: '' },
],
}),
]),
optimization: {
splitChunks: {
cacheGroups: {
common: {
name: 'common',
test: /[\\/]styles[\\/]common[\\/].*[.]scss$/,
chunks: 'all',
enforce: true,
},
},
},
minimizer: [
new Uglify({
cache: true,
parallel: true,
sourceMap: true,
}),
new OptiCSS({}),
],
},
};
export default config;