2019-09-13 13:29:49 +02:00
|
|
|
/* global __dirname, module, process */
|
2019-08-23 13:19:05 +02:00
|
|
|
const common = require("./webpack.common.js");
|
|
|
|
const merge = require("webpack-merge");
|
|
|
|
const path = require('path');
|
2019-09-13 13:29:49 +02:00
|
|
|
const webpack = require('webpack');
|
2020-02-13 14:30:29 +01:00
|
|
|
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
|
2019-08-23 14:23:12 +02:00
|
|
|
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
2020-02-13 13:33:18 +01:00
|
|
|
const CopyWebpackPlugin = require('copy-webpack-plugin');
|
2019-09-13 13:29:49 +02:00
|
|
|
const ASSET_PATH = process.env.ASSET_PATH || '/dist/'; // eslint-disable-line no-process-env
|
|
|
|
|
2019-08-23 13:19:05 +02:00
|
|
|
module.exports = merge(common, {
|
|
|
|
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
|
|
|
},
|
2019-08-23 14:23:12 +02:00
|
|
|
plugins: [
|
2020-02-13 17:00:56 +01:00
|
|
|
new CleanWebpackPlugin({
|
|
|
|
cleanStaleWebpackAssets: false // resolves conflict with CopyWebpackPlugin
|
|
|
|
}),
|
2019-09-13 13:29:49 +02:00
|
|
|
new MiniCssExtractPlugin({filename: '../dist/converse.min.css'}),
|
2020-02-13 13:33:18 +01:00
|
|
|
new CopyWebpackPlugin([
|
2020-02-16 12:30:25 +01:00
|
|
|
{from: 'sounds'},
|
2020-02-13 13:33:18 +01:00
|
|
|
{from: 'images/favicon.ico'},
|
|
|
|
{from: 'images/custom_emojis', to: 'custom_emojis'},
|
|
|
|
{from: 'sass/webfonts', to: 'webfonts'}
|
|
|
|
]),
|
2019-09-13 13:29:49 +02:00
|
|
|
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 14:23:12 +02:00
|
|
|
],
|
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: {
|
|
|
|
includePaths: [
|
|
|
|
path.resolve(__dirname, 'node_modules/')
|
|
|
|
],
|
|
|
|
sourceMap: true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}]
|
|
|
|
}
|
2019-08-23 13:19:05 +02:00
|
|
|
});
|
|
|
|
|