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

"Require is not defined" #592

Open
adambedford opened this issue Aug 22, 2023 · 1 comment
Open

"Require is not defined" #592

adambedford opened this issue Aug 22, 2023 · 1 comment

Comments

@adambedford
Copy link

I just upgraded from 1.6.0 to 2.6.3 and have run into an issue when loading the app in the browser (no build errors in the console).

image

Notably, I was upgrading ember-basic-dropdown & ember-power-select, which prompted me to update ember-auto-import to a version >=2.

My guess is that something is expecting a node environment instead of the browser so require would be available but I cannot tell what that might be or where to begin digging based on the error message.

package.json looks like the following. Relatively old Ember (3.28)

{
  "name": "frontend",
  "version": "0.0.0",
  "private": true,
  "description": "Small description for frontend goes here",
  "repository": "",
  "license": "MIT",
  "author": "",
  "directories": {
    "doc": "doc",
    "test": "tests"
  },
  "scripts": {
    "build": "ember build",
    "lint:hbs": "ember-template-lint .",
    "lint:js": "eslint .",
    "start": "ember serve",
    "test": "ember test"
  },
  "devDependencies": {
    "@ember/jquery": "^1.1.0",
    "@ember/optional-features": "^1.3.0",
    "@ember/render-modifiers": "^1.0.2",
    "@fortawesome/ember-fontawesome": "^0.2.2",
    "@fortawesome/free-brands-svg-icons": "^5.13.1",
    "@fortawesome/free-regular-svg-icons": "^5.10.0",
    "@fortawesome/free-solid-svg-icons": "^5.7.2",
    "@splidejs/splide": "^2.4.21",
    "babel-eslint": "^10.1.0",
    "babel-plugin-dynamic-import-node": "^2.3.3",
    "bootstrap": "^4.0.0",
    "broccoli-asset-rev": "^2.7.0",
    "ember-ajax-fetch": "^0.0.0",
    "ember-arg-types": "^0.2.1",
    "ember-auto-import": "^1.6.0",
    "ember-autofocus-modifier": "^1.0.1",
    "ember-autoresize": "^1.3.2",
    "ember-autoresize-modifier": "^0.6.0",
    "ember-basic-dropdown": "^7.2.1",
    "ember-bootstrap": "^4.9.0",
    "ember-bootstrap-changeset-validations": "^1.0.0",
    "ember-bootstrap-power-select": "^4.1.0",
    "ember-can": "^3.0.0",
    "ember-changeset": "^2.0.0",
    "ember-changeset-conditional-validations": "^0.6.0",
    "ember-changeset-validations": "^2.0.0",
    "ember-cli": "~3.28.0",
    "ember-cli-airbrake": "^0.2.1",
    "ember-cli-app-version": "^3.2.0",
    "ember-cli-babel": "^7.26.11",
    "ember-cli-bootswatch": "^2.0.2",
    "ember-cli-bs-pagination": "^0.0.4",
    "ember-cli-clipboard": "^0.13.0",
    "ember-cli-dependency-checker": "^3.0.0",
    "ember-cli-deploy": "^1.0.2",
    "ember-cli-deploy-s3-pack": "^1.0.1",
    "ember-cli-eslint": "^4.2.3",
    "ember-cli-favicon": "^2.2.0",
    "ember-cli-htmlbars": "^5.2.0",
    "ember-cli-inject-live-reload": "^1.8.2",
    "ember-cli-meta-tags": "^6.0.0",
    "ember-cli-moment-shim": "^3.7.1",
    "ember-cli-page-progress": "^1.2.1",
    "ember-cli-sass": "^10.0.0",
    "ember-cli-segment": "^4.0.0",
    "ember-cli-sri": "^2.1.1",
    "ember-cli-string-helpers": "^2.0.0",
    "ember-cli-template-lint": "^1.0.0-beta.1",
    "ember-cli-uglify": "^2.1.0",
    "ember-component-css": "^0.6.7",
    "ember-composable-helpers": "^4.2.1",
    "ember-concurrency": "^1.1.5",
    "ember-concurrency-decorators": "^1.0.0",
    "ember-custom-actions": "^3.2.0",
    "ember-data": "~3.28.0",
    "ember-decorators": "^6.1.1",
    "ember-export-application-global": "^2.0.0",
    "ember-fetch": "^6.4.0",
    "ember-file-upload": "^4.0.3",
    "ember-infinity": "^2.1.2",
    "ember-inflector": "^3.0.1",
    "ember-intercom-io": "^1.2.0",
    "ember-leaflet": "^5.0.0",
    "ember-line-clamp": "^1.0.0",
    "ember-link-action": "^0.1.3",
    "ember-load": "^0.0.17",
    "ember-load-initializers": "^1.1.0",
    "ember-math-helpers": "^2.15.0",
    "ember-maybe-import-regenerator": "^0.1.6",
    "ember-metrics": "^1.5.2",
    "ember-moment": "^7.8.1",
    "ember-notify": "^6.0.0",
    "ember-page-title": "^6.0.3",
    "ember-phone-input": "^2.0.7",
    "ember-place-autocomplete": "^1.1.1",
    "ember-power-calendar": "^0.19.0",
    "ember-power-calendar-moment": "^0.2.0",
    "ember-power-datepicker": "^0.9.0",
    "ember-power-select": "^7.1.1",
    "ember-promise-helpers": "^1.0.6",
    "ember-qunit": "^3.4.1",
    "ember-resolver": "^5.0.1",
    "ember-responsive": "^3.0.0",
    "ember-router-scroll": "^3.3.3",
    "ember-service-worker": "^0.8.4",
    "ember-service-worker-asset-cache": "^0.6.4",
    "ember-service-worker-cache-fallback": "^0.6.2",
    "ember-service-worker-cache-first": "^0.6.3",
    "ember-simple-auth": "^1.8.1",
    "ember-source": "~3.28.0",
    "ember-star-rating": "^3.0.0",
    "ember-sticky-element": "^0.2.3",
    "ember-stripe-elements": "code-corps/ember-stripe-elements#develop",
    "ember-svg-jar": "^2.2.3",
    "ember-truth-helpers": "^2.1.0",
    "ember-welcome-page": "^3.2.0",
    "ember-yeti-table": "^1.7.0",
    "eslint-plugin-ember": "^8.8.0",
    "leaflet": "^1.0.0",
    "liquid-fire": "^0.30.0",
    "loader.js": "^4.7.0",
    "qunit-dom": "^0.8.0",
    "sass": "^1.17.0"
  },
  "engines": {
    "node": "6.* || 8.* || 12.* || 14.* || 16.*",
    "yarn": "1.*"
  },
  "ember": {
    "edition": "octane"
  },
  "dependencies": {
    "@ckeditor/ckeditor5-build-classic": "^23.0.0",
    "browserlist": "^1.0.1",
    "caniuse-lite": "^1.0.30001260",
    "ember-cli-deploy-cloudfront": "^4.0.0",
    "ember-cli-update": "^0.43.7",
    "webpack": "^5.88.2"
  },
  "resolutions": {
    "ember-power-timepicker/**/ember-power-select": "^3.0.4",
    "ember-power-select-typeahead/**/ember-power-select": "^4.1.0"
  }
}

Any help or guidance would be greatly appreciated!

@ef4
Copy link
Collaborator

ef4 commented Aug 28, 2023

The require that's missing here is the ember-provided one in the browser. If you're doing unusual things in your index.html that could be the issue. This code expects to be evaluating after Ember's vendor.js.

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

2 participants