Last active
January 18, 2018 06:58
-
-
Save alihesari/7741388936d77baedd3f08f5b87a2362 to your computer and use it in GitHub Desktop.
This web pack config convert assets file (images and fonts) to base64
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
var webpack = require('webpack'); | |
var path = require('path'); | |
var ExtractTextPlugin = require('extract-text-webpack-plugin'); | |
module.exports = { | |
entry: './src/js/main.js', | |
output: { | |
path: path.resolve(__dirname, 'dist/'), | |
publicPath: 'dist/', | |
filename: 'bundle.js' | |
}, | |
module: { | |
rules: [ | |
{ | |
test: /\.scss$/, | |
use: ExtractTextPlugin.extract({ | |
fallback: 'style-loader', | |
use: [ | |
{ | |
loader: 'css-loader', | |
options: { | |
// minimize: true | |
} | |
}, | |
{ | |
loader: 'sass-loader' | |
}, | |
] | |
}) | |
}, | |
{ | |
test: /\.(png|jpg|jpeg|woff|woff2|eot|ttf|svg)$/, | |
loader: 'url-loader?limit=100000', | |
} | |
] | |
}, | |
plugins: [ | |
new ExtractTextPlugin('[name].css', { allChunks: true }), | |
] | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment