File tree Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Expand file tree Collapse file tree 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> {
8080 pyodide . site_packages = `/lib/python${ pymajor } .${ pyminor } /site-packages` ;
8181
8282 // 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.
8386 if ( USING_OLDEST_PYODIDE_VERSION ) {
8487 // Inject at cloudflare.workers for backwards compatibility
8588 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(
412412 continue ;
413413 }
414414
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 ()) {
417419 continue ;
418420 }
419421
You can’t perform that action at this time.
0 commit comments