forked from teeso/Chatbot-Widget
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.prod.js
68 lines (66 loc) · 1.67 KB
/
webpack.config.prod.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
'use strict'
const webpack = require('webpack');
const path = require('path');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin');
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
module.exports = {
entry: './index.js',
output: {
path: path.join(__dirname, '/dist'),
filename: 'articulate-chatbot-widget.js',
library: 'ArticulateChatbotWidget',
libraryTarget: 'umd'
},
resolve: {
extensions: ['.js']
},
mode: 'production',
module: {
rules: [
{
test: /\.js?$/,
loader: "babel-loader",
exclude: /(node_modules|bower_components)/
},
{
test: /\.(png|jpe?g|gif)$/i,
use: [
{
loader: 'file-loader',
},
],
},
{
test: /\.css$/i,
use: [
MiniCssExtractPlugin.loader,
'css-loader'
]
}
]
},
plugins: [
new CleanWebpackPlugin(),
/**
* Known issue for the CSS Extract Plugin in Ubuntu 16.04: You'll need to install
* the following package: sudo apt-get install libpng16-dev
*/
new MiniCssExtractPlugin({
filename: 'articulate-chatbot-widget.css',
chunkFileName: '[id].css'
}),
//new BundleAnalyzerPlugin() Enable if you want to check stats
],
optimization: {
minimizer: [
new UglifyJsPlugin({
cache: true,
parallel: true
}),
new OptimizeCSSAssetsPlugin({})
]
}
};