File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
turbopack/crates/turbopack-core/src/resolve Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -162,6 +162,20 @@ impl Request {
162162 return Request :: Empty ;
163163 }
164164
165+ // Handle webpack-style tilde prefix (~) for node_modules resolution
166+ // This is commonly used in CSS preprocessors like less-loader and sass-loader
167+ // Only strip ~ if it's followed by a module path (not a relative path like ~/home)
168+ // for utoopack issue: https://github.com/utooland/utoo/issues/2309
169+ let r = if let Some ( remainder) = r
170+ . strip_prefix ( '~' )
171+ . filter ( |s| !s. is_empty ( ) && !s. starts_with ( '/' ) && !s. starts_with ( '\\' ) )
172+ . filter ( |s| MODULE_PATH . is_match ( s) )
173+ {
174+ remainder. into ( )
175+ } else {
176+ r
177+ } ;
178+
165179 if let Some ( remainder) = r. strip_prefix ( "//" ) {
166180 return Request :: Uri {
167181 protocol : rcstr ! ( "//" ) ,
You can’t perform that action at this time.
0 commit comments