IHaskell/jupyterlab-ihaskell/webpack.config.js
Vaibhav Sagar 0d647a949f
Update jupyterlab-ihaskell for 4.x (#1426)
* [WIP] Update jupyterlab-ihaskell for 4.x

* Address feedback

* jupyterlab-ihaskell: more updates

* jupyterlab-ihaskell: don't minify

* jupyterlab-ihaskell: update

* jupyterlab-ihaskell: change mimetype

* jupyterlab-ihaskell: update

* jupyterlab-ihaskell: works with JupyterLab 4

* jupyterlab-ihaskell: update id

* jupyterlab-ihaskell: simplify

* jupyterlab-ihaskell: update
2024-04-21 19:10:08 +10:00

30 lines
992 B
JavaScript

const fs = require('fs-extra');
const path = require('path');
const packagePath = '.';
const data = fs.readJSONSync(path.join(packagePath, 'package.json'));
const outputPath = path.join(packagePath, data.jupyterlab['outputDir']);
class FixupEntryPoint {
apply(compiler) {
compiler.hooks.done.tap('FixupEntryPoint', (stats) => {
const data = fs.readJSONSync(path.join(outputPath, "package.json"));
const remoteEntry = data.jupyterlab._build.load;
const remoteEntryRe = /static\/remoteEntry\.(.*)\.js/;
const remoteEntryDash = remoteEntry.replace(remoteEntryRe, "static/remoteEntry-$1.js");
fs.moveSync(path.join(outputPath, remoteEntry), path.join(outputPath, remoteEntryDash));
data.jupyterlab._build.load = remoteEntryDash;
fs.writeJSONSync(path.join(outputPath, "package.json"), data, { spaces: 2 });
});
};
};
module.exports = {
output: {
filename: "[name]-[contenthash].js"
},
plugins: [
new FixupEntryPoint()
],
}