Created
October 6, 2017 08:55
-
-
Save hannigand/606d8654fa8902153a602b3dc1717c30 to your computer and use it in GitHub Desktop.
A simple Webpack config to build CSS, images and fonts.
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
const path = require('path'); | |
module.exports = { | |
entry: './src/index.js', | |
output: { | |
filename: 'bundle.js', | |
path: path.resolve(__dirname, 'dist'), | |
}, | |
module: { | |
rules: [ | |
{ | |
test: /\.css$/, | |
use: ['style-loader', 'css-loader'], | |
}, | |
{ | |
test: /\.(png|svg|jpg|gif)$/, | |
use: [ | |
{ | |
loader: 'file-loader', | |
options: { | |
outputPath: 'images/', | |
name: '[hash].[ext]', | |
}, | |
}, | |
{ | |
loader: 'image-webpack-loader', | |
options: { | |
pngquant: { | |
quality: '65-90', | |
}, | |
}, | |
}, | |
], | |
}, | |
{ | |
test: /\.(woff|woff2|eot|ttf|otf)$/, | |
use: [ | |
{ | |
loader: 'file-loader', | |
options: { | |
outputPath: 'fonts/', | |
}, | |
}, | |
], | |
}, | |
], | |
}, | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment