Skip to content
Snippets Groups Projects
Commit 0da6ed2e authored by Reiter, Christoph's avatar Reiter, Christoph :snake:
Browse files

Give up on manual chunking

There still is no content based hashing and it interferes with dynamic imports
where most of the chunks get loaded before they are actualy imported.

Just remove it.
parent 83f77030
No related branches found
No related tags found
No related merge requests found
......@@ -39,7 +39,6 @@ let pdfAsQualifiedlySigningServer = '';
let matomoSiteId = 131;
let useTerser = true;
let useBabel = true;
let useManualChunks = true;
let checkLicenses = !watch;
switch (build) {
......@@ -91,32 +90,6 @@ switch (build) {
process.exit(1);
}
const CHUNK_BLACKLIST = [
'jszip', // jszip is a node module by default and rollup chunking is confused by that and emits warnings
'source-sans-pro',
'@open-wc/scoped-elements', // produces no code
];
/**
* Returns a list of chunks used for splitting up the bundle.
* We recursively use every dependency and ever internal dev dependency (starting with 'vpu-').
*/
function getManualChunks(pkg) {
let manualChunks = Object.keys(pkg.dependencies).reduce(function (acc, item) { acc[item] = [item]; return acc;}, {});
const vpu = Object.keys(pkg.devDependencies).reduce(function (acc, item) { if (item.startsWith('vpu-')) acc[item] = [item]; return acc;}, {});
for (const vpuName in vpu) {
const subPkg = require('./node_modules/' + vpuName + '/package.json');
manualChunks = Object.assign(manualChunks, getManualChunks(subPkg));
}
manualChunks = Object.assign(manualChunks, vpu);
for(const name of CHUNK_BLACKLIST) {
delete manualChunks[name];
}
return manualChunks;
}
/**
* Creates a server certificate and caches it in the .cert directory
*/
......@@ -173,8 +146,8 @@ export default {
format: 'esm',
sourcemap: true
},
preserveEntrySignatures: false,
// external: ['zlib', 'http', 'fs', 'https', 'url'],
manualChunks: useManualChunks ? getManualChunks(pkg) : false,
onwarn: function (warning, warn) {
// ignore "suggestions" warning re "use strict"
if (warning.code === 'MODULE_LEVEL_DIRECTIVE') {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment