Skip to content

Commit f7103ca

Browse files
committed
chore: Remove unused Map support from next/dynamic transform
1 parent a49fc30 commit f7103ca

File tree

1 file changed

+7
-17
lines changed

1 file changed

+7
-17
lines changed

packages/next/src/build/babel/plugins/react-loadable-plugin.ts

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,13 @@ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
1919
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWAR
2020
*/
2121
// This file is https://github.com/jamiebuilds/react-loadable/blob/master/src/babel.js
22-
// Modified to also look for `next/dynamic`
23-
// Modified to put `webpack` and `modules` under `loadableGenerated` to be backwards compatible with next/dynamic which has a `modules` key
24-
// Modified to support `dynamic(import('something'))` and `dynamic(import('something'), options)
22+
// - Modified to also look for `next/dynamic`
23+
// - Modified to put `webpack` and `modules` under `loadableGenerated` to be
24+
// backwards compatible with next/dynamic which has a `modules` key
25+
// - Modified to support `dynamic(import('something'))` and
26+
// `dynamic(import('something'), options)
27+
// - Removed `Loadable.Map` support, `next/dynamic` uses overloaded arguments
28+
// instead of a separate API
2529

2630
import type {
2731
NodePath,
@@ -60,20 +64,6 @@ export default function ({
6064

6165
binding.referencePaths.forEach((refPath) => {
6266
let callExpression = refPath.parentPath
63-
64-
if (
65-
callExpression?.isMemberExpression() &&
66-
callExpression.node.computed === false
67-
) {
68-
const property = callExpression.get('property')
69-
if (
70-
!Array.isArray(property) &&
71-
property.isIdentifier({ name: 'Map' })
72-
) {
73-
callExpression = callExpression.parentPath
74-
}
75-
}
76-
7767
if (!callExpression?.isCallExpression()) return
7868

7969
let args = callExpression.get('arguments')

0 commit comments

Comments
 (0)