Open bengotow opened 8 years ago
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
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.
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 forrig-mime-types
, which took me a while to find when trying to contribute to the project.It also fixes a few issues:
.es6
JS files and.litcoffee
files read via require.Resolves my general confusion in #145 :-)