We are using webpack to package Typescript files. The problem is the Bitbucket server is repackaging them (as bundle.js) and we are loosing the source maps.
I know there was a way to disable this, so the bitbucket server just serves the unaltered javascript.
The compressResources would only disable compression but not batching, which is a good idea if you create and minify your bundles using webpack and webpack WRM plugin. If your bundle is already compressed, then the compressResources is actually doing an extra job that is not needed.
However, I wouldn’t recommend disabling the batching in the production environment. This would slow down downloading the assets.
As for the problem with sourcemaps it’s a known issue. The Web-Resource Manager (WRM) can’t combine the sourcemaps created by webpack. We have an open ticket for that: [PLUGWEB-447] - Ecosystem Jira
Usually, when I need to debug the code in the developrment environment I create a bundle without minification. Example:
// webpack.config.js
const SKIP_MINIMIZE = process.env.SKIP_MINIMIZE === 'true';
const minimizeBundle = !SKIP_MINIMIZE;
if (!minimizeBundle) {
console.log('[Webpack] Skipping minimization of the bundles');
}
module.exports = {
// the rest of the config
optimization: {
minimize: minimizeBundle,
// the rest of the minimization config
},
});
}
With this setting, you can run a webpack with the environment variable SKIP_MINIMIZE e.g.
SKIP_MINIMIZE=true webpack --mode=production
I hope that helps. Let me know in case you have more questions.
In addition to what Adam said, you might be able to use the “quickreload” plugin to disable batching. See this page: Quick Reload - Controlling web batching (Scroll down to “Controlling Web Batching”)
This should leave source maps intact.
It should be working with quick reload - I have some function using this in my bash profile to switch it on / off - I am usually doing it at the same time as switching dev mode on / off :
curl -X PUT "http://localhost:$CONTEXT/rest/qr/systemproperties/atlassian.dev.mode/${VALUE}"
curl -X PUT "http://localhost:$CONTEXT/rest/qr/systemproperties/plugin.webresource.batching.off/${VALUE}"