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

TypeError: URI is not a function #377

Closed
sunknudsen opened this issue Mar 27, 2019 · 4 comments
Closed

TypeError: URI is not a function #377

sunknudsen opened this issue Mar 27, 2019 · 4 comments
Labels

Comments

@sunknudsen
Copy link

Working on an older frontend stack (no Babel etc...).

Concatenated node_modules/uri-js/dist/es5/uri.all.js with my other vendors.

The following code used to work but now throws a type error (it is used to get the value of the bearer query string of the current URI).

var bearer = URI().query(true)['bearer'];

Am I doing something wrong?

@rodneyrehm
Copy link
Member

That code is correct, so the problem must be how/when you load the library.

  • please check if you're using requirejs or something like that
  • please check the order of concatenation, the library must be loaded before it's used…

@sunknudsen
Copy link
Author

@rodneyrehm As mentioned, I am not using contemporary build tools such as RequireJS. I am simply concatenating the content of node_modules/uri-js/dist/es5/uri.all.js with the rest of my vendors which are loaded before the rest of my app (not ideal, but old stack as mentioned). The result for version 1.19.1 is that the variable URI exists but is an object not a function so the above code throws a type error.

This process worked fine up until version 1.18.12 for which I simply concatenated the content of node_modules/urijs/src/URI.js with the rest of my vendors.

Perhaps you dropped support for older ways of adding the library to codebases?

@rodneyrehm
Copy link
Member

Perhaps you dropped support for older ways of adding the library to codebases?

not according to https://github.com/medialize/URI.js/releases - v1.18.12...v1.19.1 doesn't contain any changes that would suggest loading would behave differently.

@sunknudsen
Copy link
Author

Goddamn, installed uri-js vs urijs. Confusing set of URI utilities on NPM. Thanks for your help @rodneyrehm. Sorry for submitting this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants