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

119 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'];
2018-05-24 21:09:33 +02: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: {
path: path.resolve(__dirname, 'dist'), // Output path for generated bundles
chunkFilename: '[name].js'
},
entry: path.resolve(__dirname, 'src/entry.js'),
2018-05-24 21:09:33 +02:00
externals: [{
"window": "window"
}],
watchOptions: {
ignored: [/dist/, /spec/, /.*\~/]
},
2018-05-24 21:09:33 +02:00
module: {
rules: [
{
test: path.resolve(__dirname, "node_modules/xss/dist/xss"),
use: "exports-loader?filterXSS,filterCSS"
}, {
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: {
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: [path.resolve(__dirname, 'node_modules/')]
},
sourceMap: true
}
}
]
2018-05-24 21:09:33 +02:00
}, {
test: /\.js$/,
include: /src/,
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
}
}]
],
plugins: [
2020-12-29 12:52:53 +01:00
'lodash',
'@babel/plugin-proposal-class-properties',
'@babel/plugin-proposal-nullish-coalescing-operator',
'@babel/plugin-proposal-optional-chaining',
'@babel/plugin-syntax-dynamic-import'
]
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',
path.resolve(__dirname, "src")
2018-05-24 21:09:33 +02:00
],
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")
2018-05-24 21:09:33 +02:00
}
}
}