This repository has been archived by the owner on Aug 28, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.common.js
113 lines (112 loc) · 3.19 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
112
113
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
entry: {
main: './src/js/main.js',
about: './src/js/about.js',
jtc: './src/js/jtc.js',
sagoo: './src/js/sagoo.js',
tremors: './src/js/tremors.js',
bbw: './src/js/bbw.js',
publication: './src/js/publication.js',
accha: './src/js/accha.js'
},
module: {
rules: [
{
test: /\.m?js$/,
exclude: /(node_modules|bower_components)/,
use: {
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env'],
plugins: ["@babel/plugin-proposal-class-properties"]
}
}
},
{
test: /\.(png|svg|jpe?g|gif|ico|webm|webp|mp4)$/i,
use: [{
loader: 'file-loader',
options: {
name: '[path][name].[ext]',
context: './src/'
},
}, ]
},
{
test: /\.(woff|woff2|eot|ttf|otf)$/i,
use: [{
loader: 'file-loader',
options: {
name: '/fonts/[name].[ext]',
},
}, ]
},
{
test: require.resolve('jquery'),
use: [{
loader: 'expose-loader',
options: 'jQuery'
}, {
loader: 'expose-loader',
options: '$'
}
]
}
],
},
devtool: false,
resolve: {
alias: {
"jquery": path.resolve('node_modules', "jquery/src/jquery.js"),
"TweenLite": path.resolve('node_modules', 'gsap/src/uncompressed/TweenLite.js'),
"TweenMax": path.resolve('node_modules', 'gsap/src/uncompressed/TweenMax.js'),
"TimelineLite": path.resolve('node_modules', 'gsap/src/uncompressed/TimelineLite.js'),
"TimelineMax": path.resolve('node_modules', 'gsap/src/uncompressed/TimelineMax.js'),
"ScrollMagic": path.resolve('node_modules', 'scrollmagic/scrollmagic/uncompressed/ScrollMagic.js'),
"animation.gsap": path.resolve('node_modules', 'scrollmagic/scrollmagic/uncompressed/plugins/animation.gsap.js'),
"debug.addIndicators": path.resolve('node_modules', 'scrollmagic/scrollmagic/uncompressed/plugins/debug.addIndicators.js'),
"lazysizes": path.resolve('node_modules', "lazysizes/lazysizes.js"),
"smooth-scrollbar": path.resolve('node_modules', "smooth-scrollbar/index.js")
},
},
// optimization: {
// splitChunks: {
// chunks: 'all',
// },
// },
plugins: [
// new HtmlWebpackPlugin({
// template: './src/index.html',
// inject: 'body',
// chunks: ['main'],
// filename: 'index.html'
// },
// new HtmlWebpackPlugin({
// template: './src/jtc.html',
// inject: 'body',
// chunks: ['jtc'],
// filename: 'jtc.html'
// }),
// new HtmlWebpackPlugin({
// template: './src/sagoo.html',
// inject: 'body',
// chunks: ['sagoo'],
// filename: 'sagoo.html'
// }),
// new HtmlWebpackPlugin({
// template: './src/bbw.html',
// inject: 'body',
// chunks: ['bbw'],
// filename: 'bbw.html'
// })
// )
],
output: {
filename: 'js/[name].js',
path: path.resolve(__dirname, 'dist'),
library: "my-library",
libraryTarget: "umd"
}
};