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

123 lines
3.6 KiB
JavaScript
Raw Normal View History

/* global __dirname, module, process */
const TerserPlugin = require("terser-webpack-plugin");
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'
},
devtool: "source-map",
optimization: {
minimize: true,
minimizer: [
new TerserPlugin({
include: /\.min\.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+)?$/,
type: 'asset/resource',
generator: {
filename: '[name][ext]',
publicPath: 'webfonts/',
outputPath: 'webfonts/'
}
}, {
test: /\.scss$/,
use: [
'style-loader',
{
loader: 'css-loader',
options: {
url: false,
sourceMap: true
}
},
{
loader: "postcss-loader",
options: { sourceMap: true }
},
{
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'
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"),
"punycode": path.resolve(__dirname, "../node_modules/urijs/src/punycode"),
2022-06-20 21:04:42 +02:00
"./shims": path.resolve(__dirname, "../src/strophe-shims.js"),
2018-05-24 21:09:33 +02:00
}
}
2018-05-24 21:09:33 +02:00
}