Skip to content

Commit

Permalink
Don't bundle prop-types to then tree shake it (#9944)
Browse files Browse the repository at this point in the history
  • Loading branch information
timneutkens committed Jan 4, 2020
1 parent 12a877d commit 8898b85
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/next/client/link.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ declare const __NEXT_DATA__: any

import { resolve, parse, UrlObject } from 'url'
import React, { Component, Children } from 'react'
import PropTypes from 'prop-types'
import Router from './router'
import { rewriteUrlForNextExport } from '../next-server/lib/router/rewrite-url-for-export'
import {
Expand Down Expand Up @@ -108,7 +107,6 @@ const listenToIntersections = (el: any, cb: any) => {
}

class Link extends Component<LinkProps> {
static propTypes?: any
p: boolean

constructor(props: LinkProps) {
Expand Down Expand Up @@ -283,7 +281,9 @@ if (process.env.NODE_ENV === 'development') {
const warn = execOnce(console.error)

// This module gets removed by webpack.IgnorePlugin
const PropTypes = require('prop-types')
const exact = require('prop-types-exact')
// @ts-ignore the property is supported, when declaring it on the class it outputs an extra bit of code which is not needed.
Link.propTypes = exact({
href: PropTypes.oneOfType([PropTypes.string, PropTypes.object]).isRequired,
as: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),
Expand All @@ -294,7 +294,7 @@ if (process.env.NODE_ENV === 'development') {
scroll: PropTypes.bool,
children: PropTypes.oneOfType([
PropTypes.element,
(props: any, propName) => {
(props: any, propName: string) => {
const value = props[propName]

if (typeof value === 'string') {
Expand Down

0 comments on commit 8898b85

Please sign in to comment.