-
Notifications
You must be signed in to change notification settings - Fork 173
/
webpack.config.js
85 lines (81 loc) · 2.37 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
var BundleTracker = require('webpack-bundle-tracker'),
MiniCssExtractPlugin = require('mini-css-extract-plugin'),
path = require('path'),
webpack = require('webpack'),
loaders = [
MiniCssExtractPlugin.loader,
'css-loader',
{
loader: 'sass-loader',
options: {
sassOptions: {
includePaths: [path.resolve('./sass/')]
}
}
}
],
context = path.join(__dirname, 'course_discovery/static');
module.exports = {
context: context,
mode: 'production',
entry: {
'query-preview': './js/query-preview.js',
'course-skills-admin': './js/course-skills-admin.js',
'query-preview.style': './sass/query-preview.scss'
},
output: {
path: path.join(context, './bundles/'),
filename: '[name]-[hash].js',
publicPath: ''
},
plugins: [
new BundleTracker({filename: './webpack-stats.json'}),
new webpack.ProvidePlugin({
$: 'jquery',
jQuery: 'jquery',
'window.jQuery': 'jquery'
}),
new MiniCssExtractPlugin({filename: '[name]-[hash].css'})
],
module: {
rules: [
{
test: /\.s?css$/,
use: loaders
},
{
test: /\.woff2?$/,
// Inline small woff files and output them below font
use: [{
loader: 'url-loader',
options: {
name: 'font/[name]-[hash].[ext]',
limit: 5000,
mimetype: 'application/font-woff'
}
}]
},
{
test: /\.(ttf|eot|svg)$/,
use: [{
loader: 'file-loader',
options: {
name: 'font/[name]-[hash].[ext]'
}
}]
},
{
test: require.resolve('datatables.net'),
use: 'imports-loader?define=>false'
},
{
test: require.resolve('datatables.net-bs'),
use: 'imports-loader?define=>false'
}
]
},
resolve: {
modules: ['node_modules'],
extensions: ['.css', '.js', '.scss']
}
};