Skip to content
This repository has been archived by the owner on Jan 25, 2020. It is now read-only.

Allow other require extensions #87

Open
wants to merge 3 commits into
base: v1.x
Choose a base branch
from
Open

Conversation

scttdavs
Copy link

I have a routes.coffee and routes.json file I'm using in my project and it is breaking. However using routes.js instead of coffee works.

What happens is that when it tries to require the coffee file, it loads the json file first, which cannot export a function so the assertion fails. I created a fix here which first looks at .js and then tries all other require extensions other than json.

@jasisk
Copy link
Member

jasisk commented Apr 13, 2016

Hey @scttdavs,

Sorry for the delay—I've been out of town for a couple of days. I'm catching up on a few things but I just wanted to acknowledge your PR. Thanks for submitting—I'll get to it shortly. 😀

@scttdavs
Copy link
Author

thanks! I added a test to make it a little more clear. Also confirmed it failed before and fixed afterward.

@scttdavs
Copy link
Author

any update on this?

@IcanDivideBy0
Copy link

Just a reminder that require.extensions is deprecated and breaks jest compatibility.
I'd like to submit a PR to fix that, I think it could also fix your issue by providing an option to express-enrouten which specify allowed extensions.
@jasisk what are your thoughts ?

@tlivings
Copy link
Member

tlivings commented Nov 4, 2016

I agree the extensions should be passed as an option.

Otherwise looks good.

@gabrielcsapo
Copy link
Contributor

@scttdavs thoughts on changing the implementation to allow extensions to passed as an option instead of using require?

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

Successfully merging this pull request may close these issues.

None yet

5 participants