New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom webpack.config.js for federated extensions #9175
Comments
I like the idea for the developer to be able to customize webpack. With the proposed diff, it looks that |
Perhaps the location should be another item in the package.json jupyterlab key? |
This does mean that we would essentially be making webpack an official part of the api, which is quite a change from our original direction of not exposing that as an implementation detail. That is an important distinction and decision. Is there a specific usecase in mind, or is this a theoretical usecase? |
Yes that's probably the main issue.
This repo for example bundles local WebAssembly modules and uses top level await: https://github.com/jtpio/jupyterlab-wasm-example And with webpack 5:
https://webpack.js.org/blog/2020-10-10-webpack-5-release/#experiments So having a way to hook into the webpack config to add the following experiments is quite convenient: {
experiments: {
topLevelAwait: true,
asyncWebAssembly: true,
}
} As an alternative, extension authors could probably build their own builder on top of Or patch This is also similar to this issue: #4328. (but giving control on the whole webpack config and not just the rules). Also now with federated extensions this wouldn't affect the global lab config, only the one for the federated extension. But would still make webpack part of the api. |
Would we provide this feature to extension authors only, or extension+core? If we provide it only to extension authors, the risk or decision trade-off to use those specific webpack configs can be clearly documented and the author should know what he/she does. |
Adding to the 3.0 milestone for consideration (even if end up deciding not to do anything about it for 3.0). |
That would only apply to federated extension (with the build process almost entirely managed by
But that still means that webpack will be part of the API we expose to extension authors? And that it would be marked as |
I've thought about this for a bit. I'm okay with going forward here, in the spirit of making it possible for developers to experiment more easily, if we move quickly to get this in (i.e., so we can have at least one RC with it in to test it, and we don't delay the final release): I think for implementation details:
@jtpio - do you want to propose a PR we can more specifically discuss? I realize my opinion is only one opinion, but I think if we are going to try to have this as even a possibility for 3.0, we need to have a specific PR we can discuss since the timeline is so short. I have hope since there were no huge objections raised to the main question in the dev meeting or on this issue in the last week. |
Just opened a draft PR (still incomplete, will continue early next week): #9224 |
Since the config used to build a federated extension is generated here:
jupyterlab/builder/src/extensionConfig.ts
Line 25 in 90b58a8
It looks it should be possible to let the extension author specify additional options.
For example specifying experiments: https://webpack.js.org/configuration/experiments
Maybe there could be the possibility to do so, for example by loading a
webpack.config.js
local to the extension, and merging it with the rest of the generated config?Something like this:
The text was updated successfully, but these errors were encountered: