Unverified Commit 3e3f09f4 authored by Maia Teegarden's avatar Maia Teegarden Committed by GitHub

Use correct arg for require.resolveWeak (#29719)

* Use correct arg for require.resolveWeak

* Build next-swc binaries
parent fb529e65
...@@ -125,7 +125,12 @@ impl Fold for NextDynamicPatcher { ...@@ -125,7 +125,12 @@ impl Fold for NextDynamicPatcher {
}))), }))),
args: vec![ExprOrSpread { args: vec![ExprOrSpread {
expr: Box::new(Expr::Lit(Lit::Str(Str { expr: Box::new(Expr::Lit(Lit::Str(Str {
value: self.filename.to_string().into(), value: self
.dynamically_imported_specifier
.as_ref()
.unwrap()
.clone()
.into(),
span: DUMMY_SP, span: DUMMY_SP,
kind: StrKind::Synthesized {}, kind: StrKind::Synthesized {},
has_escape: false, has_escape: false,
......
...@@ -2,13 +2,13 @@ import dynamic1 from 'next/dynamic' ...@@ -2,13 +2,13 @@ import dynamic1 from 'next/dynamic'
import dynamic2 from 'next/dynamic' import dynamic2 from 'next/dynamic'
const DynamicComponent1 = dynamic1(() => import('../components/hello1'), { const DynamicComponent1 = dynamic1(() => import('../components/hello1'), {
loadableGenerated: { loadableGenerated: {
webpack: () => [require.resolveWeak('/some-project/src/some-file.js')], webpack: () => [require.resolveWeak('../components/hello1')],
modules: ['some-file.js -> ' + '../components/hello1'], modules: ['some-file.js -> ' + '../components/hello1'],
}, },
}) })
const DynamicComponent2 = dynamic2(() => import('../components/hello2'), { const DynamicComponent2 = dynamic2(() => import('../components/hello2'), {
loadableGenerated: { loadableGenerated: {
webpack: () => [require.resolveWeak('/some-project/src/some-file.js')], webpack: () => [require.resolveWeak('../components/hello2')],
modules: ['some-file.js -> ' + '../components/hello2'], modules: ['some-file.js -> ' + '../components/hello2'],
}, },
}) })
...@@ -2,7 +2,7 @@ import dynamic from 'next/dynamic' ...@@ -2,7 +2,7 @@ import dynamic from 'next/dynamic'
import somethingElse from 'something-else' import somethingElse from 'something-else'
const DynamicComponent = dynamic(() => import('../components/hello'), { const DynamicComponent = dynamic(() => import('../components/hello'), {
loadableGenerated: { loadableGenerated: {
webpack: () => [require.resolveWeak('/some-project/src/some-file.js')], webpack: () => [require.resolveWeak('../components/hello')],
modules: ['some-file.js -> ' + '../components/hello'], modules: ['some-file.js -> ' + '../components/hello'],
}, },
}) })
......
import dynamic from 'next/dynamic' import dynamic from 'next/dynamic'
const DynamicComponent = dynamic(() => import('../components/hello'), { const DynamicComponent = dynamic(() => import('../components/hello'), {
loadableGenerated: { loadableGenerated: {
webpack: () => [require.resolveWeak('/some-project/src/some-file.js')], webpack: () => [require.resolveWeak('../components/hello')],
modules: ['some-file.js -> ' + '../components/hello'], modules: ['some-file.js -> ' + '../components/hello'],
}, },
}) })
...@@ -3,7 +3,7 @@ const DynamicComponentWithCustomLoading = dynamic(()=>import("../components/hell ...@@ -3,7 +3,7 @@ const DynamicComponentWithCustomLoading = dynamic(()=>import("../components/hell
, { , {
loadableGenerated: { loadableGenerated: {
webpack: ()=>[ webpack: ()=>[
require.resolveWeak("/some-project/src/some-file.js") require.resolveWeak("../components/hello")
] ]
, ,
modules: [ modules: [
......
...@@ -3,7 +3,7 @@ const DynamicComponent = dynamic(()=>handleImport(import("./components/hello")) ...@@ -3,7 +3,7 @@ const DynamicComponent = dynamic(()=>handleImport(import("./components/hello"))
, { , {
loadableGenerated: { loadableGenerated: {
webpack: ()=>[ webpack: ()=>[
require.resolveWeak("/some-project/src/some-file.js") require.resolveWeak("./components/hello")
] ]
, ,
modules: [ modules: [
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment