forked from destinygg/website
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
78 lines (77 loc) · 2.47 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
const webpack = require('webpack');
const path = require('path');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const CleanWebpackPlugin = require('clean-webpack-plugin');
module.exports = {
entry: {
common: [
'core-js/es6',
'jquery',
'moment',
'font-awesome/scss/font-awesome.scss',
'bootstrap/dist/css/bootstrap.css',
'bootstrap/dist/js/bootstrap.js'
],
web : './assets/web.js',
admin : './assets/admin.js',
messages : './assets/messages.js',
chat : './assets/chat.js',
streamchat: './assets/streamchat.js'
},
output: {
path : __dirname + '/static',
filename : '[name].js'
},
plugins: [
new CleanWebpackPlugin(['static'], {root: __dirname, verbose: false, exclude: ['cache']}),
new webpack.ProvidePlugin({'$': 'jquery', 'jQuery': 'jquery', 'window.jQuery': 'jquery'}),
new webpack.optimize.CommonsChunkPlugin({name:'common', filename:'common.js'}),
new ExtractTextPlugin({filename: '[name].css'})
],
module: {
rules: [
{
test : /\.(ts|tsx)$/,
loader : 'ts-loader'
},
{
test : /\.json$/,
loader : 'json-loader'
},
{
test : /\.js$/,
exclude : /(node_modules)/,
loader : 'babel-loader',
options : {presets: ['es2015']}
},
{
test : /\.(scss|css)$/,
loader : ExtractTextPlugin.extract({
fallback: 'style-loader',
use: [
{loader: 'css-loader'},
{loader: 'sass-loader'},
]
})
},
{
test : /(-webfont|glyphicons-halflings-regular)\.(eot|svg|ttf|woff2?)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
loader : 'file-loader',
options : {name: 'fonts/[name].[ext]'}
},
{
test : /\.(png|jpg|gif)$/,
loader : 'file-loader',
options : {name: 'img/[name].[ext]'}
}
]
},
resolve: {
alias: {
jquery: 'jquery/src/jquery'
},
extensions: ['.ts','.tsx','.js']
},
context: __dirname,
devtool: false
};