|
@@ -144,15 +144,42 @@ fs.copyFileSync(
|
|
|
path.join(outputPath, 'package.orig.json')
|
|
|
);
|
|
|
|
|
|
+// TODO: We don't need this file after our compilation, since it is folded
|
|
|
+// into remoteEntry.js. We should either delete it, or figure out a way to
|
|
|
+// have the entry point below be dynamically generated text without having to
|
|
|
+// write to a file.
|
|
|
+const publicpath = path.join(outputPath, 'publicPath.js');
|
|
|
+fs.writeFileSync(
|
|
|
+ publicpath,
|
|
|
+ `
|
|
|
+function getOption(name) {
|
|
|
+ let configData = Object.create(null);
|
|
|
+ // Use script tag if available.
|
|
|
+ if (typeof document !== 'undefined' && document) {
|
|
|
+ const el = document.getElementById('jupyter-config-data');
|
|
|
+
|
|
|
+ if (el) {
|
|
|
+ configData = JSON.parse(el.textContent || '{}');
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return configData[name] || '';
|
|
|
+}
|
|
|
+
|
|
|
+// eslint-disable-next-line no-undef
|
|
|
+__webpack_public_path__ = getOption('fullLabextensionsUrl') + '/${data.name}/';
|
|
|
+`
|
|
|
+);
|
|
|
+
|
|
|
module.exports = [
|
|
|
merge(baseConfig, {
|
|
|
// Using empty object {} for entry because we want only
|
|
|
// entrypoints generated by ModuleFederationPlugin
|
|
|
- entry: {},
|
|
|
+ entry: {
|
|
|
+ [data.name]: publicpath
|
|
|
+ },
|
|
|
output: {
|
|
|
filename: '[name].[chunkhash].js',
|
|
|
- path: outputPath,
|
|
|
- publicPath: `/lab/extensions/${data.name}/`
|
|
|
+ path: outputPath
|
|
|
},
|
|
|
module: {
|
|
|
rules: [{ test: /\.html$/, use: 'file-loader' }]
|