Skip to content

Instantly share code, notes, and snippets.

@davidcsejtei
Created September 26, 2018 19:24
Show Gist options
  • Save davidcsejtei/ddc6cc4308116ae9254db2f79bc381c7 to your computer and use it in GitHub Desktop.
Save davidcsejtei/ddc6cc4308116ae9254db2f79bc381c7 to your computer and use it in GitHub Desktop.
var path = require('path');
var webpack = require('webpack');
var CompressionPlugin = require('compression-webpack-plugin');
module.exports = {
entry: '',
output: {
path: path.resolve(__dirname, ''),
filename: '',
library: '',
libraryTarget: 'umd'
},
module: {
rules: [
{
test: /\.js$/,
include: path.resolve(__dirname, ''),
exclude: /(node_modules|library)/,
use: {
loader: 'babel-loader',
}
},
{
test: /\.scss$/,
include: [],
use: [
{loader: "style-loader"},
{loader: "css-loader"},
{loader: "sass-loader"}
]
},
{
test: /\.css$/,
use: [
{loader: "style-loader"},
{loader: "css-loader"},
{loader: "sass-loader"}
]
},
]
},
plugins: [
new webpack.DefinePlugin({
'process.env': {
'NODE_ENV': JSON.stringify('production')
}
}),
new webpack.optimize.UglifyJsPlugin(),
new webpack.optimize.AggressiveMergingPlugin(),
new CompressionPlugin({
asset: "[path].gz[query]",
algorithm: "gzip",
test: /\.js$|\.css$|\.html$/,
threshold: 10240,
minRatio: 0.8
})
],
externals: {
react: {
root: 'React',
commonjs2: 'react',
commonjs: 'react',
amd: 'react'
},
'react-dom': {
root: 'ReactDOM',
commonjs2: 'react-dom',
commonjs: 'react-dom',
amd: 'react-dom'
}
},
devServer: {
inline: true,
port: 9001
},
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment