You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am on the latest version of Snowpack & all plugins.
I use package manager npm (Fill in: npm, yarn, pnpm, etc).
I run Snowpack on OS macos (Fill in: Windows, Mac, Linux, etc).
I run Snowpack on Node.js v12+
Describe the bug
Using react-router-dom fails in Snowpack 3.1.1 when used in conjunction with
React 16.14.0. This previously worked in Snowpack 3.0.13.
Attempting to use the router results in the following error:
Uncaught TypeError: checkPropTypes is not a function
at validatePropTypes (react.v16.14.0.js:1729)
I suspect this is because react's compiled output expects checkPropTypes to be a
function however it is imported using a namespace definition which is not callable.
// At the top of /_snowpack/pkg/react.v16.14.0.js
import * as checkPropTypes from '/_snowpack/pkg/prop-types.checkPropTypes.v15.7.2.js';
The issue goes away if I either:
Use snowpack 3.0.13 and react 16.14.0 (downgrade snowpack, keep react version)
Use snowpack 3.1.1 and react >=17.0.0 (keep snowpack version, update react)
@BPScott thanks for filing. Funny enough, I tracked this down to the snippet of code that we'd originally talked through related to ESM vs. CJS detection. More details here, including the fix to add back that check: #2934
Bug Report Quick Checklist
Describe the bug
Using react-router-dom fails in Snowpack 3.1.1 when used in conjunction with
React 16.14.0. This previously worked in Snowpack 3.0.13.
Attempting to use the router results in the following error:
I suspect this is because react's compiled output expects checkPropTypes to be a
function however it is imported using a namespace definition which is not callable.
The issue goes away if I either:
To Reproduce
Reproduction repository is here
npm install && npm start
General steps
import { BrowserRouter as Router } from "react-router-dom";
in App component<Router></Router>
Expected behavior
Page to render, no errors
The text was updated successfully, but these errors were encountered: