ldr-make-img-tiny-loader
v0.0.3
Published
Use [tinypng.com](https://tinypng.com) upload/download achieve compress images
Downloads
3
Readme
make-img-tiny-loader
Use tinypng.com upload/download achieve compress images
常见问题
https://cloud.tencent.com/developer/article/1363596
Feature
- [X] Mini size
- [X] Cache
Install
$ yarn add --dev make-img-tiny-loader file-loader@latest babel-loader@latest url-loader@latest
OR
$ npm i --save-dev make-img-tiny-loader file-loader@latest babel-loader@latest url-loader@latest
Usage
const path = require('path')
module.exports = {
mode: 'development',
entry: {
app: path.join(__dirname, './demo/index.js') // 打包内容入口
},
output: {
path: path.join(__dirname, './test/') // 出口
},
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: 'babel-loader'
},
{
test: /\.(png|jpg|gif)$/i,
use: [
{
loader: 'url-loader',
options: {
limit: 10000,
name: 'img/[name].[ext]',
publicPath: '/'
}
},
{
loader: path.resolve(__dirname, './node_modules/make-img-tiny-loader/dist/index.js')
}
]
}
]
},
optimization: {
minimize: false
}
}