forked from conversejs/converse.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.common.js
122 lines (119 loc) · 3.83 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
114
115
116
117
118
119
120
121
122
/* global __dirname, module, process */
const path = require('path');
let bootstrap_ignore_modules = ['carousel', 'scrollspy', 'tooltip', 'toast'];
const BOOTSTRAP_IGNORE_MODULES = (process.env.BOOTSTRAP_IGNORE_MODULES || '').replace(/ /g, '').trim();
if (BOOTSTRAP_IGNORE_MODULES.length > 0) {
bootstrap_ignore_modules = bootstrap_ignore_modules.concat(BOOTSTRAP_IGNORE_MODULES.split(','));
}
module.exports = {
output: {
path: path.resolve(__dirname, 'dist'), // Output path for generated bundles
chunkFilename: '[name].js'
},
entry: path.resolve(__dirname, 'src/entry.js'),
externals: [{
"window": "window"
}],
watchOptions: {
ignored: /dist/,
},
module: {
rules: [
{
test: path.resolve(__dirname, "node_modules/xss/dist/xss"),
use: "exports-loader?filterXSS"
}, {
test: /LC_MESSAGES\/converse.po$/,
type: "json",
use: [
{
loader: 'po-loader',
options: {
'format': 'jed',
'domain': 'converse'
}
}
]
}, {
test: /webfonts\/.*\.(woff(2)?|ttf|eot|truetype|svg)(\?v=\d+\.\d+\.\d+)?$/,
use: [
{
loader: 'file-loader',
options: {
name: '[name].[ext]',
outputPath: 'webfonts/'
}
}
]
}, {
test: /\.scss$/,
use: [
'style-loader',
{
loader: 'css-loader',
options: {
sourceMap: true
}
},
'postcss-loader',
{
loader: 'sass-loader',
options: {
sassOptions: {
includePaths: [
path.resolve(__dirname, 'node_modules/'),
path.resolve(__dirname, 'src/')
]
},
sourceMap: true
}
}
]
}, {
test: /\.js$/,
include: [
/src/,
/node_modules\/mergebounce/,
/node_modules\/lit-html/,
/node_modules\/strophe/,
/node_modules\/pluggable/,
/node_modules\/@converse/,
],
use: {
loader: 'babel-loader',
options: {
presets: [
["@babel/preset-env", {
"targets": {
"browsers": [">1%", "not ie 11", "not op_mini all", "not dead"]
}
}]
],
plugins: []
}
}
}, {
test: /bootstrap\.native/,
use: {
loader: 'bootstrap.native-loader',
options: {
bs_version: 4,
ignore: bootstrap_ignore_modules
}
}
}],
},
resolve: {
extensions: ['.js'],
modules: [
'node_modules',
path.resolve(__dirname, "src")
],
alias: {
"IPv6": path.resolve(__dirname, "node_modules/urijs/src/IPv6"),
"SecondLevelDomains": path.resolve(__dirname, "node_modules/urijs/src/SecondLevelDomains"),
"formdata-polyfill": path.resolve(__dirname, "node_modules/formdata-polyfill/FormData"),
"punycode": path.resolve(__dirname, "node_modules/urijs/src/punycode")
}
}
}