|
@@ -1,23 +1,19 @@
|
|
-/*global path, __dirname, module, process */
|
|
|
|
-'use strict'
|
|
|
|
|
|
+const HTMLWebpackPlugin = require('html-webpack-plugin');
|
|
const minimist = require('minimist');
|
|
const minimist = require('minimist');
|
|
const path = require('path');
|
|
const path = require('path');
|
|
const webpack = require('webpack');
|
|
const webpack = require('webpack');
|
|
-const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
|
|
|
|
|
|
|
const config = {
|
|
const config = {
|
|
entry: path.resolve(__dirname, 'src/converse.js'),
|
|
entry: path.resolve(__dirname, 'src/converse.js'),
|
|
externals: [{
|
|
externals: [{
|
|
"window": "window"
|
|
"window": "window"
|
|
}],
|
|
}],
|
|
- output: {
|
|
|
|
- path: path.resolve(__dirname, 'dist'), // Output path for generated bundles
|
|
|
|
- publicPath: '/dist/', // URL base path for all assets
|
|
|
|
- filename: 'converse.js',
|
|
|
|
- chunkFilename: '[name].js'
|
|
|
|
- },
|
|
|
|
- devtool: 'source-map',
|
|
|
|
- plugins: [new MiniCssExtractPlugin({filename: '../dist/converse.css'})],
|
|
|
|
|
|
+ plugins: [
|
|
|
|
+ new HTMLWebpackPlugin({
|
|
|
|
+ title: 'Production',
|
|
|
|
+ template: 'webpack.html'
|
|
|
|
+ })
|
|
|
|
+ ],
|
|
module: {
|
|
module: {
|
|
rules: [
|
|
rules: [
|
|
{
|
|
{
|
|
@@ -29,7 +25,7 @@ const config = {
|
|
use: "exports-loader?filterXSS,filterCSS"
|
|
use: "exports-loader?filterXSS,filterCSS"
|
|
},
|
|
},
|
|
{
|
|
{
|
|
- test: /templates\/.*\.(html|svg)$/,
|
|
|
|
|
|
+ test: /\.(html|svg)$/,
|
|
exclude: /node_modules/,
|
|
exclude: /node_modules/,
|
|
use: [{
|
|
use: [{
|
|
loader: 'lodash-template-webpack-loader',
|
|
loader: 'lodash-template-webpack-loader',
|
|
@@ -74,7 +70,7 @@ const config = {
|
|
test: /\.scss$/,
|
|
test: /\.scss$/,
|
|
use: [
|
|
use: [
|
|
'style-loader',
|
|
'style-loader',
|
|
- MiniCssExtractPlugin.loader, {
|
|
|
|
|
|
+ {
|
|
loader: 'css-loader',
|
|
loader: 'css-loader',
|
|
options: {
|
|
options: {
|
|
sourceMap: true
|
|
sourceMap: true
|
|
@@ -82,12 +78,13 @@ const config = {
|
|
}, {
|
|
}, {
|
|
loader: 'sass-loader',
|
|
loader: 'sass-loader',
|
|
options: {
|
|
options: {
|
|
- includePaths: [
|
|
|
|
- path.resolve(__dirname, 'node_modules/')
|
|
|
|
- ],
|
|
|
|
- sourceMap: true
|
|
|
|
|
|
+ includePaths: [
|
|
|
|
+ path.resolve(__dirname, 'node_modules/'),
|
|
|
|
+ ],
|
|
|
|
+ sourceMap: true
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- }]
|
|
|
|
|
|
+ ]
|
|
}, {
|
|
}, {
|
|
test: /\.js$/,
|
|
test: /\.js$/,
|
|
exclude: /(node_modules|spec|mockup)/,
|
|
exclude: /(node_modules|spec|mockup)/,
|
|
@@ -176,15 +173,6 @@ function parameterize () {
|
|
}];
|
|
}];
|
|
}
|
|
}
|
|
|
|
|
|
- if (type === 'css') {
|
|
|
|
- console.log("Building only CSS");
|
|
|
|
- config.entry = path.resolve(__dirname, 'sass/converse.scss');
|
|
|
|
- config.output = {
|
|
|
|
- path: path.resolve(__dirname, 'tmp'),
|
|
|
|
- filename: 'css-builder.js'
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
if (mode === 'production') {
|
|
if (mode === 'production') {
|
|
console.log("Making a production build");
|
|
console.log("Making a production build");
|
|
const fn = config.output.filename;
|
|
const fn = config.output.filename;
|