Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] JSON files imported by deps throw an error, downgrading to older versions has "too many #3297

Open
5 tasks done
DanProudfoot opened this issue May 11, 2021 · 0 comments

Comments

@DanProudfoot
Copy link

DanProudfoot commented May 11, 2021

Bug Report Quick Checklist

  • I am on the latest version of Snowpack & all plugins.
  • I use package manager npm
  • I run Snowpack on OS Mac (Fill in: Windows, Mac, Linux, etc).
  • I run Snowpack on Node.js v12+
  • I'm using source: "remote"

Describe the bug

I'm test migrating a create-react-app app over to snowpack, so I can learn about the benefits, etc of Snowpack.

I've found that, in migrating over, I can't get the app to boot because of an error in the browser console

Failed to load module script: The server responded with a non-JavaScript MIME type of "application/json". Strict MIME type checking is enforced for module scripts per HTML spec.

As far as I can tell, this isn't a JSON file I'm importing myself - indeed the file referenced seems to be http://localhost:8080/_snowpack/pkg/-/entities@v1.1.2-8Cauvwsy6UxU2k1OBsYo/dist=es2020,mode=imports/unoptimized/maps/decode.json. It don't know what package is loading "entities". (But if I had to make a wild guess, I'd assume it's Amplify...)

I've seen similar tickets to this issue, such as #3194, #3109 and #3282. That last one is especially interesting as it says a user had some success downgrading

Same problem for me on 3.3.6. But i was able to build on 3.0.13

If I downgrade to that version, I instead get another error, where all of my dependencies in the browser throw the error Too many redirects before it gets to the point of throwing the JSON error above (I presume). #2345 suggests that that error is caused by plugin-react-refresh, but disabling that plugin doesn't solve anything.

To Reproduce

We can't fix bugs that we can't see for ourselves. Issues often need to be closed if this section is skipped.

  1. npm init snowpack-app --template @snowpack/app-template-react
  2. Install all deps from my 'source' app
  3. Start the dev server
  4. Load up localhost:8080 and wait for everything to load
  5. See error!

Expected behavior

The app doesn't get stuck trying to load JSON. Potentially even boots up

Anything else?

I'll attach my deps here, didn't want to put them inline as it ends up cluttering the ticket

{
  "dependencies": {
    "@capacitor-community/react-hooks": "^0.0.11",
    "@capacitor/android": "2.4.5",
    "@capacitor/cli": "^2.4.5",
    "@capacitor/core": "^2.4.5",
    "@capacitor/ios": "2.4.5",
    "@hookform/resolvers": "^1.3.4",
    "@ionic/pwa-elements": "^3.0.2",
    "@sentry/react": "^6.3.5",
    "@sentry/tracing": "^6.3.5",
    "@stripe/react-stripe-js": "^1.4.0",
    "@stripe/stripe-js": "^1.14.0",
    "aws-amplify": "^3.4.0",
    "body-scroll-lock": "^3.1.5",
    "capacitor-branch-deep-links": "^3.0.0",
    "cloudinary-react": "^1.7.0",
    "d3-ease": "^2.0.0",
    "embla-carousel": "^4.5.1",
    "framer-motion": "^4.1.13",
    "jotai": "^0.16.3",
    "jwt-decode": "^3.1.2",
    "lodash-es": "^4.17.21",
    "lottie-react": "^2.1.0",
    "mixpanel-browser": "^2.41.0",
    "moment": "^2.29.1",
    "polished": "^4.1.2",
    "query-string": "^7.0.0",
    "quick-score": "^0.0.12",
    "react": "^17.0.2",
    "react-circular-progressbar": "^2.0.4",
    "react-dom": "^17.0.2",
    "react-ga": "^2.5.7",
    "react-google-charts": "^3.0.15",
    "react-hook-form": "^6.15.4",
    "react-html-parser": "^2.0.2",
    "react-infinite-scroll-component": "^6.1.0",
    "react-input-range": "^1.3.0",
    "react-move": "^6.4.0",
    "react-query": "^3.15.2",
    "react-redux": "^7.2.4",
    "react-router-dom": "^5.2.0",
    "react-scroll": "^1.8.2",
    "react-select": "^4.3.0",
    "react-use": "^17.2.4",
    "redux": "^4.1.0",
    "redux-thunk": "^2.3.0",
    "sanitize.css": "^12.0.1",
    "styled-components": "^5.3.0",
    "video-react": "^0.14.1",
    "vite-plugin-babel-macros": "^1.0.5",
    "yup": "^0.32.9"
  },
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant