File tree Expand file tree Collapse file tree 1 file changed +23
-1
lines changed
Expand file tree Collapse file tree 1 file changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -193,7 +193,29 @@ void InitializeImportMetaHot(v8::Isolate* isolate,
193193 if (query.empty ()) return originAndPath;
194194
195195 if (isAppMod) {
196- return originAndPath;
196+ // Treat query params as part of module identity (browser-like),
197+ // but ignore internal `import` markers.
198+ std::vector<std::string> kept;
199+ size_t start = 0 ;
200+ while (start <= query.size ()) {
201+ size_t amp = query.find (' &' , start);
202+ std::string pair = (amp == std::string::npos) ? query.substr (start) : query.substr (start, amp - start);
203+ if (!pair.empty ()) {
204+ size_t eq = pair.find (' =' );
205+ std::string name = (eq == std::string::npos) ? pair : pair.substr (0 , eq);
206+ if (!(name == " import" )) kept.push_back (pair);
207+ }
208+ if (amp == std::string::npos) break ;
209+ start = amp + 1 ;
210+ }
211+ if (kept.empty ()) return originAndPath;
212+ std::sort (kept.begin (), kept.end ());
213+ std::string rebuilt = originAndPath + " ?" ;
214+ for (size_t i = 0 ; i < kept.size (); i++) {
215+ if (i > 0 ) rebuilt += " &" ;
216+ rebuilt += kept[i];
217+ }
218+ return rebuilt;
197219 }
198220
199221 if (isRt || isCore) {
You can’t perform that action at this time.
0 commit comments