Update nodeps webpack config to create chunks in the right place

This commit is contained in:
JC Brand 2019-09-11 17:08:20 +02:00
parent bd67dc3fac
commit 41c4f9ceb2
3 changed files with 5 additions and 29 deletions

View File

@ -5,6 +5,11 @@ const path = require('path');
const webpack = require('webpack');
const config = {
output: {
path: path.resolve(__dirname, 'dist'), // Output path for generated bundles
publicPath: '/dist/', // URL base path for all assets
chunkFilename: '[name].js'
},
entry: path.resolve(__dirname, 'src/converse.js'),
externals: [{
"window": "window"
@ -148,36 +153,11 @@ function parameterize () {
const type = minimist(process.argv.slice(2)).type;
const mode = minimist(process.argv.slice(2)).mode;
const lang = minimist(process.argv.slice(2)).lang;
if (type === 'headless') {
console.log("Making a headless build");
config.entry = "@converse/headless/headless.js";
config.output.filename = 'converse-headless.js';
}
if (type === 'nodeps') {
console.log("Making a build without 3rd party dependencies");
config.output.filename = 'converse-no-dependencies.js';
config.externals = [{
"backbone": "backbone",
"backbone.nativeview": "backbone.nativeview",
"backbone.vdomview": "backbone.vdomview",
"backbone.browserStorage": "backbone.browserStorage",
"backbone.overview": "backbone.overview",
"es6-promise": "es6-promise",
"lodash": "lodash",
"lodash.converter": "lodash.converter",
"lodash.noconflict": "lodash.noconflict",
"strophe": "strophe",
"window": "window"
}];
}
if (mode === 'production') {
console.log("Making a production build");
const fn = config.output.filename;
config.output.filename = `${fn.replace(/\.js$/, '')}.min.js`;
}
}
parameterize();

View File

@ -55,7 +55,6 @@ module.exports = merge(common, {
"es6-promise": "es6-promise",
"formdata-polyfill": "formdata-polyfill",
"lodash": "lodash",
"lodash.converter": "lodash.converter",
"lodash.noconflict": "lodash.noconflict",
"strophe": "strophe",
"window": "window",

View File

@ -6,10 +6,7 @@ const MiniCssExtractPlugin = require('mini-css-extract-plugin');
module.exports = merge(common, {
output: {
path: path.resolve(__dirname, 'dist'), // Output path for generated bundles
publicPath: '/dist/', // URL base path for all assets
filename: 'converse.min.js',
chunkFilename: '[name].js'
},
plugins: [
new MiniCssExtractPlugin({filename: '../dist/converse.min.css'})