mirror of
https://github.com/IHaskell/IHaskell.git
synced 2025-04-14 10:26:07 +00:00

* [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
30 lines
992 B
JavaScript
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()
|
|
],
|
|
}
|