Replies: 2 comments
-
| 
         I have same problem with you  | 
  
Beta Was this translation helpful? Give feedback.
                  
                    0 replies
                  
                
            -
| 
         How did you end up fixing it?  | 
  
Beta Was this translation helpful? Give feedback.
                  
                    0 replies
                  
                
            
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
        
    
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
When using Redux Toolkit with a Preact app, I get this error in the browser console:
This error is thrown when attempting to
import {Provider} from 'react-redux;. This crashes the app immediately; nothing is rendered. I also see thatreact-reduxdoes not appear to be inweb_moduleswhen I runsnowpack build. When the bundler is running, it does not output any error messages; it only throws this error in the browser.I can recreate a minimal case to display this error from
create-snowpack-app. Here are the steps to duplicate:$ cd test-case $ npm install @reduxjs/toolkit react-redux --saveThe dependency versions in my
package.jsonare as follows:{ [...] "dependencies": { "@reduxjs/toolkit": "^1.4.0", "preact": "^10.4.6", "react-redux": "^7.2.1" }, "devDependencies": { "@snowpack/app-scripts-preact": "^1.8.2", "@testing-library/jest-dom": "^5.5.0", "@testing-library/preact": "^1.0.2", "jest": "^25.4.0", "prettier": "^2.0.5", "snowpack": "^2.7.5" } }snowpack.config.json:{ "extends": "@snowpack/app-scripts-preact", "plugins": [], "alias": { "react": "preact/compat", "react-dom/test-utils": "preact/test-utils", "react-dom": "preact/compat" } }./src/store.js:<Provider>component andstoreobject intoApp.jsx:npm start(alias forsnowpack dev) and then open the page in the browser.What I expect to see: The rendered bootstrapped application.
What I see: Nothing. The page is blank. When I open the console I see
Uncaught TypeError: Error resolving module specifier: react-redux.Things I've tried:
react-reduxas expected, however, the app crashes because it expects to findreact(which is not present because I'm usingpreact.) This causes me to suspect aliasing may be a culprit.Things I did not try:
Hope anyone has insights to share. Thanks!
Beta Was this translation helpful? Give feedback.
All reactions