-
Notifications
You must be signed in to change notification settings - Fork 3
/
webpack.config.js
93 lines (92 loc) · 2.98 KB
/
webpack.config.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
const HtmlWebpackPlugin = require('html-webpack-plugin')
const ExtractTextPlugin = require('extract-text-webpack-plugin')
const UglifyJsPlugin = require('uglifyjs-webpack-plugin')
module.exports = {
context: __dirname + '/app',
devtool: 'source-map',
entry: './show.js',
output: {
path: __dirname + '/dist',
filename: 'show.[chunkhash].js',
},
module: {
rules: [
{
test: require.resolve('jquery'),
use: [{
loader: 'expose-loader',
options: 'jQuery',
}],
},
{
test: /\.js$/,
exclude: /\bnode_modules\b/,
use: {
loader: 'babel-loader',
options: {
//presets: [ [ 'env', {
// targets: {
// browsers: 'since 2017',
// },
//} ] ],
plugins: [
require("babel-plugin-transform-es2015-template-literals"),
require("babel-plugin-transform-es2015-literals"),
require("babel-plugin-transform-es2015-function-name"),
require("babel-plugin-transform-es2015-arrow-functions"),
require("babel-plugin-transform-es2015-block-scoped-functions"),
require("babel-plugin-transform-es2015-classes"),
require("babel-plugin-transform-es2015-object-super"),
require("babel-plugin-transform-es2015-shorthand-properties"),
require("babel-plugin-transform-es2015-computed-properties"),
require("babel-plugin-transform-es2015-for-of"),
require("babel-plugin-transform-es2015-sticky-regex"),
require("babel-plugin-transform-es2015-unicode-regex"),
require("babel-plugin-check-es2015-constants"),
require("babel-plugin-transform-es2015-spread"),
require("babel-plugin-transform-es2015-parameters"),
require("babel-plugin-transform-es2015-destructuring"),
require("babel-plugin-transform-es2015-block-scoping"),
require("babel-plugin-transform-es2015-typeof-symbol"),
// Nix CommonJS-ness so Babel can do some tree-shaking
//require("babel-plugin-transform-es2015-modules-commonjs"),
[require("babel-plugin-transform-regenerator"), { async: false, asyncGenerators: false }],
],
},
},
},
{
test: /\.(woff2|png)$/,
use: 'base64-inline-loader',
},
{
test: /\.css$/,
use: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: [ 'css-loader' ],
}),
},
],
},
plugins: [
new ExtractTextPlugin({
filename: '[name].[contenthash].css',
}),
new HtmlWebpackPlugin({
title: 'Word Cloud',
filename: 'show',
template: 'show.html',
cache: false,
}),
new UglifyJsPlugin({
uglifyOptions: {
compress: {
ecma: 6,
},
output: {
ecma: 6,
},
},
}),
]
}