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-06-18 13:33:56 +02:00
|
|
|
new CopyWebpackPlugin({
|
|
|
|
patterns: [
|
|
|
|
{from: 'sounds', to: 'sounds'},
|
|
|
|
{from: 'node_modules/@fortawesome/fontawesome-free/sprites/solid.svg', to: '@fortawesome/fontawesome-free/sprites/solid.svg'},
|
|
|
|
{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'}
|
|
|
|
]
|
|
|
|
}),
|
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: {
|
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
|
|
|
});
|
|
|
|
|