-
Notifications
You must be signed in to change notification settings - Fork 4
/
webpack.common.js
111 lines (110 loc) · 3.42 KB
/
webpack.common.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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
const HtmlWebpackPlugin = require('html-webpack-plugin');
const path = require('path');
const webpack = require('webpack')
const CopyWebpackPlugin = require('copy-webpack-plugin')
const cleanWebpackPlugin = require('clean-webpack-plugin')
const ScriptExtHtmlWebpackPlugin = require('script-ext-html-webpack-plugin')
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
module.exports = {
entry: {
css: __dirname + "/src/css.js",
index: __dirname + "/src/index.js",
index2: __dirname + "/src/index2.js",
},
output: {
path: path.resolve(__dirname, 'dist'),
filename: '[name].bundle.js',
publicPath: ''
},
resolve: {
modules: ['node_modules'],
alias: {
'TweenLite': 'gsap/src/minified/TweenLite.min.js',
'TweenMax': 'gsap/src/minified/TweenMax.min.js',
'TimelineLite': 'gsap/src/minified/TimelineLite.min.js',
'TimelineMax': 'gsap/src/minified/TimelineMax.min.js',
'ScrollMagic': 'scrollmagic/scrollmagic/minified/ScrollMagic.min.js',
'animation.gsap': 'scrollmagic/scrollmagic/minified/plugins/animation.gsap.min.js',
'debug.addIndicators': 'scrollmagic/scrollmagic/minified/plugins/debug.addIndicators.min.js',
}
},
module: {
rules: [
{
test: /\.js$/,
use: 'babel-loader',
exclude: [
/node_modules/
]
},
{
test: /\.css$/,
use: [
'style-loader', {
loader: 'css-loader',
options: {
url: false,
}
}],
},
// {
// test: /\.(png|woff|woff2|eot|ttf|svg)$/,
// use:['url-loader']
// },
// {
// test: /\.(gif|jpe?g|svg)$/i,
// use: [
// 'file-loader',
// {
// loader: 'image-webpack-loader',
// options: {
// //bypassOnDebug: true, // [email protected]
// //disable: true, // [email protected] and newer
// mozjpeg: {
// progressive: true,
// quality: 65
// },
// },
// },
// ],
// }
]
},
plugins: [
new cleanWebpackPlugin(['dist']),
new HtmlWebpackPlugin({
template: __dirname + "/src/public/index.html",
inject: 'body'
}),
new ScriptExtHtmlWebpackPlugin({
//sync: /index/,
defaultAttribute: 'defer'
}),
// new webpack.ProvidePlugin({
// $: "jquery",
// jQuery: "jquery",
// }),
new CopyWebpackPlugin([
// './favicon.ico',
'./README.md',
'./CNAME',
{from: './src/public/assets', to: 'assets'}
// './favicon.png',
], {}) // options
],
optimization: {
splitChunks: {
chunks: 'all'
},
usedExports: true,
minimizer: [
new UglifyJsPlugin({
uglifyOptions: {
output: {
comments: false,
},
},
}),
],
},
};