forked from FreeFeed/freefeed-react-client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.bookmarklet.config.babel.js
60 lines (57 loc) · 1.52 KB
/
webpack.bookmarklet.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
// import webpack from 'webpack';
import CSSMinimizer from 'css-minimizer-webpack-plugin';
import Terser from 'terser-webpack-plugin';
import ESLintPlugin from 'eslint-webpack-plugin';
import CompressionPlugin from 'compression-webpack-plugin';
import { gzip } from '@gfx/zopfli';
import { baseConfig, opts, rules } from './webpack/base';
import { skipFalsy } from './webpack/utils';
import { BOOKMARKLET_POPUP_PATH } from './src/bookmarklet/loader';
const config = {
...baseConfig,
entry: {
bookmarklet: skipFalsy(['./src/bookmarklet/popup.js']),
},
output: {
...baseConfig.output,
filename: BOOKMARKLET_POPUP_PATH,
},
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,
}),
!opts.dev &&
new CompressionPlugin({
compressionOptions: {
numiterations: 5,
},
algorithm(input, compressionOptions, callback) {
return gzip(input, compressionOptions, callback);
},
}),
]),
optimization: {
moduleIds: 'deterministic',
minimizer: [new Terser(), new CSSMinimizer()],
},
};
export default config;