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

131 lines
4.3 KiB
JavaScript
Raw Normal View History

2019-10-16 17:17:29 +02:00
/* global __dirname, module */
2018-05-24 21:09:33 +02:00
const path = require('path');
bootstrap_ignore_modules = ['carousel', 'scrollspy'];
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: /\.(html|svg)$/,
2018-05-24 21:09:33 +02:00
exclude: /node_modules/,
use: [{
loader: 'lodash-template-webpack-loader',
options: {
"escape": /\{\{\{([\s\S]+?)\}\}\}/g,
"evaluate": /\{\[([\s\S]+?)\]\}/g,
"interpolate": /\{\{([\s\S]+?)\}\}/g,
// By default, template places the values from your data in the
// local scope via the with statement. However, you can specify
// a single variable name with the variable setting. This can
// significantly improve the speed at which a template is able
// to render.
"variable": 'o',
"prependFilenameComment": __dirname
}
}]
}, {
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: {
includePaths: [
path.resolve(__dirname, 'node_modules/'),
],
sourceMap: true
}
}
]
2018-05-24 21:09:33 +02:00
}, {
test: /\.js$/,
exclude: /(node_modules|spec|mockup)/,
use: {
loader: 'babel-loader',
options: {
presets: [
["@babel/preset-env", {
"targets": {
"browsers": [">1%", "not ie 11", "not op_mini all"]
}
}]
],
plugins: ['@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
}
}
}