File tree 1 file changed +8
-4
lines changed
packages/next-swc/crates/next-core/src
1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -420,17 +420,21 @@ pub async fn load_next_js_template(
420
420
. get_relative_path_to ( & imported)
421
421
. context ( "path has to be relative to package root" ) ?;
422
422
423
- if !relative. starts_with ( "next/" ) {
423
+ if !relative. starts_with ( "./ next/" ) {
424
424
bail ! (
425
- "Invariant: Expected relative import to start with \" next/\" , found \" {}\" " ,
425
+ "Invariant: Expected relative import to start with \" ./ next/\" , found \" {}\" " ,
426
426
relative
427
427
)
428
428
}
429
429
430
+ let relative = relative
431
+ . strip_prefix ( "./" )
432
+ . context ( "should be able to strip the prefix" ) ?;
433
+
430
434
Ok ( if is_from_request {
431
- format ! ( "from {}" , StringifyJs ( & relative) )
435
+ format ! ( "from {}" , StringifyJs ( relative) )
432
436
} else {
433
- format ! ( "import {}" , StringifyJs ( & relative) )
437
+ format ! ( "import {}" , StringifyJs ( relative) )
434
438
} )
435
439
} )
436
440
. context ( "replacing imports failed" ) ?;
You can’t perform that action at this time.
0 commit comments