2019-09-13 13:29:49 +02:00
|
|
|
/* global __dirname, module, process */
|
2020-07-22 10:04:59 +02:00
|
|
|
const ASSET_PATH = process.env.ASSET_PATH || '/dist/'; // eslint-disable-line no-process-env
|
|
|
|
const CopyWebpackPlugin = require('copy-webpack-plugin');
|
|
|
|
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
2019-08-23 13:19:05 +02:00
|
|
|
const common = require("./webpack.common.js");
|
|
|
|
const path = require('path');
|
2019-09-13 13:29:49 +02:00
|
|
|
const webpack = require('webpack');
|
2020-07-22 10:04:59 +02:00
|
|
|
const { merge} = require("webpack-merge");
|
2019-09-13 13:29:49 +02:00
|
|
|
|
2020-09-18 08:42:20 +02:00
|
|
|
const plugins = [
|
|
|
|
new MiniCssExtractPlugin({filename: '../dist/converse.min.css'}),
|
|
|
|
new CopyWebpackPlugin({
|
|
|
|
patterns: [
|
2020-09-18 11:07:45 +02:00
|
|
|
{from: 'node_modules/strophe.js/src/shared-connection-worker.js', to: 'shared-connection-worker.js'},
|
2020-09-18 08:42:20 +02:00
|
|
|
{from: 'sounds', to: 'sounds'},
|
|
|
|
{from: 'images/favicon.ico', to: 'images/favicon.ico'},
|
|
|
|
{from: 'images/custom_emojis', to: 'images/custom_emojis'},
|
|
|
|
{from: 'logo/conversejs-filled-192.png', to: 'images/logo'},
|
|
|
|
{from: 'logo/conversejs-filled-512.png', to: 'images/logo'},
|
|
|
|
{from: 'logo/conversejs-filled-192.svg', to: 'images/logo'},
|
|
|
|
{from: 'logo/conversejs-filled-512.svg', to: 'images/logo'},
|
|
|
|
{from: 'sass/webfonts', to: 'webfonts'}
|
|
|
|
]
|
|
|
|
}),
|
|
|
|
new webpack.DefinePlugin({ // This makes it possible for us to safely use env vars on our code
|
|
|
|
'process.env.ASSET_PATH': JSON.stringify(ASSET_PATH)
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2019-08-23 13:19:05 +02:00
|
|
|
module.exports = merge(common, {
|
2020-09-18 08:42:20 +02:00
|
|
|
plugins,
|
2019-08-23 13:19:05 +02:00
|
|
|
output: {
|
2019-09-13 13:29:49 +02:00
|
|
|
publicPath: ASSET_PATH,
|
2019-09-04 18:58:10 +02:00
|
|
|
filename: 'converse.min.js',
|
2019-08-23 13:19:05 +02:00
|
|
|
},
|
|
|
|
mode: "production",
|
|
|
|
devtool: "source-map",
|
2019-08-23 14:23:12 +02:00
|
|
|
module: {
|
|
|
|
rules: [{
|
|
|
|
test: /\.scss$/,
|
|
|
|
use: [
|
|
|
|
MiniCssExtractPlugin.loader,
|
|
|
|
{
|
|
|
|
loader: 'css-loader',
|
2020-02-13 12:31:10 +01:00
|
|
|
options: {
|
|
|
|
url: false,
|
|
|
|
sourceMap: true
|
|
|
|
|
|
|
|
}
|
2019-08-23 14:23:12 +02:00
|
|
|
},
|
|
|
|
'postcss-loader',
|
|
|
|
{
|
|
|
|
loader: 'sass-loader',
|
|
|
|
options: {
|
2020-04-07 14:08:01 +02:00
|
|
|
sassOptions: {
|
|
|
|
includePaths: [path.resolve(__dirname, 'node_modules/')]
|
|
|
|
},
|
2019-08-23 14:23:12 +02:00
|
|
|
sourceMap: true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}]
|
|
|
|
}
|
2019-08-23 13:19:05 +02:00
|
|
|
});
|
|
|
|
|