Skip to content

Instantly share code, notes, and snippets.

@marensas
Created January 29, 2018 10:13
Show Gist options
  • Save marensas/95b5ec03ee3cc218a042418bcc46d083 to your computer and use it in GitHub Desktop.
Save marensas/95b5ec03ee3cc218a042418bcc46d083 to your computer and use it in GitHub Desktop.
Webpack 6
var webpack = require('webpack');
var path = require('path');
var glob = require('glob');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var PurifyCSSPlugin = require('purifycss-webpack');
module.exports = {
entry: './src',
output: {
path: path.resolve(__dirname, './public'),
filename: 'index.js'
},
module: {
rules: [
{
test: /\.js$/,
exclude: /(node_modules|bower_components)/,
loader: 'babel-loader',
query: {
presets: ['env']
}
},
{
test: /\.css$/,
use: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: 'css-loader'
})
}
]
},
plugins: [
new ExtractTextPlugin('style.css'),
new PurifyCSSPlugin({
paths: glob.sync(path.join(__dirname, './src/*.js')),
minimize: true
})
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment