Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Uncaught ReferenceError when deploying to Netlify

Tags:

javascript

I have published a git repo (https://github.com/GeorgeFlorian/Forkify-App) to Netlify (https://forkify-jorje.netlify.app/) after following an Udemy tutorial:

Everything works locally, but when I deploy it I get

Uncaught ReferenceError: Fraction is not defined
    at View.js:96

Fraction is not even inside View.js module: https://github.com/GeorgeFlorian/Forkify-App/blob/main/src/js/views/View.js

It is inside another one: https://github.com/GeorgeFlorian/Forkify-App/blob/main/src/js/views/recipeView.js

I don't know how to recreate this bug. All I did was follow the tutorial. The tutor's deployment worked, mine did not.
This is package.json:

{
  "name": "forkify-app",
  "version": "1.0.0",
  "description": "",
  "default": "index.html",
  "scripts": {
    "start": "parcel index.html --open",
    "build": "parcel build index.html --dist-dir ./dist"
  },
  "repository": {
    "type": "git",
    "url": "git+https://github.com/GeorgeFlorian/Forkify-App.git"
  },
  "author": "",
  "license": "ISC",
  "bugs": {
    "url": "https://github.com/GeorgeFlorian/Forkify-App/issues"
  },
  "homepage": "https://github.com/GeorgeFlorian/Forkify-App#readme",
  "devDependencies": {
    "@parcel/transformer-sass": "^2.0.1",
    "parcel": "^2.0.1"
  },
  "dependencies": {
    "core-js": "^3.19.2",
    "fractional": "^1.0.0",
    "regenerator-runtime": "^0.13.9"
  }
}

I can't find anything relevant online and that's why I've posted here.

like image 239
George Sloata Avatar asked Mar 10 '26 22:03

George Sloata


1 Answers

I got the same error, did the same JS Udemy course by Jonas lol. I found out the problem has to do something with parcel hoisting. Insert --no-scope-hoist in front of the build command like this & try

parcel build index.html --no-scope-hoist
like image 172
Timashan Avatar answered Mar 13 '26 12:03

Timashan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!