xmpp.chapril.org-conversejs/webpack/webpack.common.js

123 lines
3.8 KiB
JavaScript
Raw Normal View History

/* global __dirname, module, process */
2018-05-24 21:09:33 +02:00
const path = require('path');
2020-12-29 12:52:53 +01:00
let bootstrap_ignore_modules = ['carousel', 'scrollspy', 'tooltip', 'toast'];
2018-05-24 21:09:33 +02:00
2021-11-14 22:42:33 +01:00
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: {
2022-01-27 12:07:52 +01:00
path: path.resolve(__dirname, '../dist'), // Output path for generated bundles
chunkFilename: '[name].js'
},
2022-01-27 12:07:52 +01:00
entry: path.resolve(__dirname, '../src/entry.js'),
2018-05-24 21:09:33 +02:00
externals: [{
"window": "window"
}],
watchOptions: {
ignored: /dist/,
},
2018-05-24 21:09:33 +02:00
module: {
rules: [
{
2022-01-08 02:31:43 +01:00
test: /LC_MESSAGES[\\/]converse.po$/,
type: "json",
use: [
{
loader: 'po-loader',
options: {
'format': 'jed',
'domain': 'converse'
}
}
]
}, {
2022-01-08 02:31:43 +01:00
test: /webfonts[\\/].*\.(woff(2)?|ttf|eot|truetype|svg)(\?v=\d+\.\d+\.\d+)?$/,
use: [
{
loader: 'file-loader',
options: {
2019-08-12 13:00:09 +02:00
name: '[name].[ext]',
outputPath: 'webfonts/'
}
}
]
}, {
test: /\.scss$/,
use: [
'style-loader',
{
loader: 'css-loader',
options: {
sourceMap: true
}
},
'postcss-loader',
{
loader: 'sass-loader',
options: {
2020-04-07 14:08:01 +02:00
sassOptions: {
includePaths: [
2022-01-27 12:07:52 +01:00
path.resolve(__dirname, '../node_modules/'),
path.resolve(__dirname, '../src/')
]
2020-04-07 14:08:01 +02:00
},
sourceMap: true
}
}
]
2018-05-24 21:09:33 +02:00
}, {
test: /\.js$/,
2021-04-29 10:38:17 +02:00
include: [
/src/,
/node_modules\/mergebounce/,
/node_modules\/lit-html/,
/node_modules\/strophe/,
2021-05-12 11:07:38 +02:00
/node_modules\/pluggable/,
/node_modules\/@converse/,
2021-04-29 10:38:17 +02:00
],
2018-05-24 21:09:33 +02:00
use: {
loader: 'babel-loader',
options: {
presets: [
["@babel/preset-env", {
"targets": {
"browsers": [">1%", "not ie 11", "not op_mini all", "not dead"]
2018-05-24 21:09:33 +02:00
}
}]
],
2021-06-29 16:15:06 +02:00
plugins: []
2018-05-24 21:09:33 +02:00
}
}
}, {
test: /bootstrap\.native/,
use: {
loader: 'bootstrap.native-loader',
options: {
2019-04-18 14:56:35 +02:00
bs_version: 4,
ignore: bootstrap_ignore_modules
}
}
2018-05-24 21:09:33 +02:00
}],
},
resolve: {
extensions: ['.js'],
2018-05-24 21:09:33 +02:00
modules: [
'node_modules',
2022-01-27 12:07:52 +01:00
path.resolve(__dirname, "../src")
2018-05-24 21:09:33 +02:00
],
alias: {
2022-01-27 12:07:52 +01:00
"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"),
"./shims": path.resolve(__dirname, "../src/strophe-shims.js"),
2018-05-24 21:09:33 +02:00
}
}
2018-05-24 21:09:33 +02:00
}