UNPKG

1.47 kBJavaScriptView Raw
1"use strict";
2var path = require("path");
3var webpack = require("webpack");
4
5var assetsPath = path.join(__dirname, "public/assets");
6
7var 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
40var fileLoaderOptions = {
41 hash: "sha512",
42 digest: "hex",
43 name: "[hash].[ext]"
44};
45
46module.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("../") // loaderUtils.getOptions() returns null for this one
77 ]
78 }
79 ]
80 }
81 }
82];