Skip to content
This repository was archived by the owner on Oct 1, 2020. It is now read-only.

Conversation

@bengotow
Copy link

@bengotow bengotow commented Nov 1, 2016

This PR replaces @paulbetts/mime-types with a local lookup table of mime types to file extensions. This is a bit less sophisticated than the previous approach, but allows electron-compile to be more flexible and removes the need for rig-mime-types, which took me a while to find when trying to contribute to the project.

It also fixes a few issues:

  • Fixes detection of .cjsx (support still required in electron-compilers)
  • Fixes detection of .tsx
  • Updates require-hook to support multiple extensions per mimetype, fixing support for .es6 JS files and .litcoffee files read via require.

Resolves my general confusion in #145 :-)

- Fixes detection of CJSX
- Fixes detection of TSX
- Update require-hook to support multiple extensions per mimetype, fixes support for `.es6` JS files and `.litcoffee` files read via require.
@bengotow bengotow force-pushed the bengotow/local-mime-types branch from 2d18567 to 877001d Compare November 1, 2016 22:24
@anaisbetts
Copy link
Contributor

anaisbetts commented Dec 13, 2016

So, the reason we use @paulcbetts/mime-types is not to add mime-types, but to remove them. The shipped mime-db is huge and takes up like megabytes of memory, and 99%+ of the MIME types are for non-web content. @paulcbetts/mime-db is stripped to only MIME types that browsers are interested in

@bengotow
Copy link
Author

bengotow commented Jan 2, 2017

Hey! Sorry for the delay - I think the issue is that @paulcbetts/mime-types is actually missing several important mime-types (for CJSX, TSX) and the current implementation doesn't allow for one-to-many compiler to mimetype mappings, (eg. for .es6). I agree mime-db is huge and unnecessary, but it seems like using a subset of the mime database for resolving compilers isn't the cleanest approach. (eg: needing rig-mime-types to add some mappings.)

In this PR @paulcbetts/mime-types is still used to resolve mime types for the protocol handler, but the file <=> compiler mapping is done in a more direct way.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants