File tree 2 files changed +7
-2
lines changed
2 files changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -80,6 +80,9 @@ async function setupPatches(pyodide: Pyodide): Promise<void> {
80
80
pyodide . site_packages = `/lib/python${ pymajor } .${ pyminor } /site-packages` ;
81
81
82
82
// Inject modules that enable JS features to be used idiomatically from Python.
83
+ //
84
+ // NOTE: setupPatches is called after memorySnapshotDoImports, so any modules injected here
85
+ // shouldn't be part of the snapshot and should filtered out in filterPythonScriptImports.
83
86
if ( USING_OLDEST_PYODIDE_VERSION ) {
84
87
// Inject at cloudflare.workers for backwards compatibility
85
88
pyodide . FS . mkdir ( `${ pyodide . site_packages } /cloudflare` ) ;
Original file line number Diff line number Diff line change @@ -412,8 +412,10 @@ kj::Array<kj::String> PythonModuleInfo::filterPythonScriptImports(
412
412
continue ;
413
413
}
414
414
415
- // don't include js or pyodide.
416
- if (firstComponent == " js" _kj.asArray () || firstComponent == " pyodide" _kj.asArray ()) {
415
+ // don't include modules that we provide and that are likely to be imported by most
416
+ // workers.
417
+ if (firstComponent == " js" _kj.asArray () || firstComponent == " pyodide" _kj.asArray () ||
418
+ firstComponent == " asgi" _kj.asArray () || firstComponent == " workers" _kj.asArray ()) {
417
419
continue ;
418
420
}
419
421
You can’t perform that action at this time.
0 commit comments