1 | "use strict";
|
2 | var path = require("path");
|
3 | var webpack = require("webpack");
|
4 |
|
5 | var assetsPath = path.join(__dirname, "public/assets");
|
6 |
|
7 | var loaderOptions = {
|
8 | mozjpeg: {
|
9 | quality: 65
|
10 | },
|
11 | pngquant: {
|
12 | quality: [0.65, 0.9],
|
13 | speed: 4
|
14 | },
|
15 | svgo: {
|
16 | plugins: [
|
17 | {
|
18 | name: 'removeViewBox',
|
19 | active: false
|
20 | },
|
21 | {
|
22 | name: 'removeEmptyAttrs',
|
23 | active: false
|
24 | }
|
25 | ]
|
26 | },
|
27 | gifsicle: {
|
28 | optimizationLevel: 7,
|
29 | interlaced: false
|
30 | },
|
31 | optipng: {
|
32 | optimizationLevel: 7,
|
33 | interlaced: false
|
34 | },
|
35 | webp: {
|
36 | quality: 75
|
37 | }
|
38 | };
|
39 |
|
40 | var fileLoaderOptions = {
|
41 | hash: "sha512",
|
42 | digest: "hex",
|
43 | name: "[hash].[ext]"
|
44 | };
|
45 |
|
46 | module.exports = [
|
47 | {
|
48 | mode: "production",
|
49 | entry: "./test/app.js",
|
50 | output: {
|
51 | path: assetsPath,
|
52 | filename: "app.[hash].js"
|
53 | },
|
54 | module: {
|
55 | rules: [
|
56 | {
|
57 | test: /.*\.(gif|png|jpe?g|svg|webp)$/i,
|
58 | use: [
|
59 | {
|
60 | loader: "file-loader",
|
61 | options: fileLoaderOptions
|
62 | },
|
63 | {
|
64 | loader: require.resolve("../"),
|
65 | options: loaderOptions
|
66 | }
|
67 | ]
|
68 | },
|
69 | {
|
70 | test: /\.bmp$/i,
|
71 | use: [
|
72 | {
|
73 | loader: "file-loader",
|
74 | options: fileLoaderOptions
|
75 | },
|
76 | require.resolve("../")
|
77 | ]
|
78 | }
|
79 | ]
|
80 | }
|
81 | }
|
82 | ];
|