This repository has been archived by the owner on Mar 17, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 131
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
We currently already have support for webpack4, so I just needed to add some tests.
- Loading branch information
Daniel Schmidt
committed
May 14, 2018
1 parent
b30e0fb
commit ac03972
Showing
2 changed files
with
82 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
'use strict'; | ||
var path = require('path'); | ||
var webpack = require('webpack'); | ||
|
||
var assetsPath = path.join(__dirname, 'public/assets'); | ||
|
||
var loaderOptions = { | ||
mozjpeg: { | ||
quality: 65 | ||
}, | ||
pngquant:{ | ||
quality: "65-90", | ||
speed: 4 | ||
}, | ||
svgo:{ | ||
plugins: [ | ||
{ | ||
removeViewBox: false | ||
}, | ||
{ | ||
removeEmptyAttrs: false | ||
} | ||
] | ||
}, | ||
gifsicle: { | ||
optimizationLevel: 7, | ||
interlaced: false | ||
}, | ||
optipng: { | ||
optimizationLevel: 7, | ||
interlaced: false | ||
}, | ||
webp: { | ||
quality: 75 | ||
} | ||
} | ||
|
||
var fileLoaderOptions = { | ||
hash: 'sha512', | ||
digest: 'hex', | ||
name: '[hash].[ext]' | ||
} | ||
|
||
module.exports = [ | ||
{ | ||
mode: 'production', | ||
entry: './test/app.js', | ||
output: { | ||
path: assetsPath, | ||
filename: 'app.[hash].js' | ||
}, | ||
module: { | ||
rules: [{ | ||
test: /.*\.(gif|png|jpe?g|svg|webp)$/i, | ||
use: [ | ||
{ | ||
loader: 'file-loader', | ||
options: fileLoaderOptions | ||
}, | ||
{ | ||
loader: require.resolve('../'), | ||
options: loaderOptions | ||
} | ||
] | ||
}, { | ||
test: /\.bmp$/i, | ||
use: [ | ||
{ | ||
loader: 'file-loader', | ||
options: fileLoaderOptions | ||
}, | ||
require.resolve('../') // loaderUtils.getOptions() returns null for this one | ||
] | ||
}] | ||
} | ||
} | ||
]; |