forked from openedx/course-discovery
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
90 lines (85 loc) · 2.46 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
var BundleTracker = require('webpack-bundle-tracker'),
ExtractTextPlugin = require('extract-text-webpack-plugin'),
path = require('path'),
webpack = require('webpack'),
loaders = [
{
loader: 'css-loader',
options: {
minimize: true
}
},
{
loader: 'sass-loader',
options: {
includePaths: [path.resolve('./sass/')]
}
}
],
context = path.join(__dirname, 'course_discovery/static');
module.exports = {
context: context,
entry: {
'base.style': './sass/main-ltr.scss',
'base.style-rtl': './sass/main-rtl.scss',
'query-preview': './js/query-preview.js',
'query-preview.style': './sass/query-preview.scss'
},
output: {
path: path.join(context, './bundles/'),
filename: '[name]-[hash].js'
},
plugins: [
new BundleTracker({filename: './webpack-stats.json'}),
new webpack.ProvidePlugin({
$: 'jquery',
jQuery: 'jquery',
'window.jQuery': 'jquery'
}),
new ExtractTextPlugin('[name]-[hash].css')
],
module: {
rules: [
{
test: /\.s?css$/,
use: ExtractTextPlugin.extract({
fallback: 'style-loader',
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']
}
};