Created
January 29, 2018 10:13
-
-
Save marensas/95b5ec03ee3cc218a042418bcc46d083 to your computer and use it in GitHub Desktop.
Webpack 6
This file contains hidden or 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 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