You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Oct 1, 2020. It is now read-only.
I'd like for electron-compile to support CJSX. I rebased #57 on top of master but found that it still didn't work. The problem is that the require-hook only maps extensions to compilers based on the mime-types database (https://github.com/electron/electron-compile/blob/master/src/require-hook.js#L13), and the mime database does not include an entry for text/cjsx:
If you log the values of ext, it looks like this. Note that text/cjsx is not the only compiler which is broken and not mapping to any file types. text/tsx is also not mapping to anything.
text/less
less
text/stylus
styl
text/jsx
jsx
application/javascript
js
text/cjsx
false <<<<<<<
text/coffeescript
coffee
text/typescript
ts
text/tsx
false <<<<<<<
text/cson
cson
text/html
html
text/jade
jade
text/plain
txt
image/svg+xml
svg
Technically, I could submit a PR to https://github.com/jshttp/mime-db to get text/cjsx in there, but they encourage contributors to submit new mimetypes to the governing body according to RFC 6838 section 5. I could do that, but it'd probably take a while, and then we'd have to get a chain of dependencies updated to support it.
I think it would be very preferable to replace all this with a lookup table of extensions to mimetypes. This would also allow for custom mappings - in N1, we use .es6 for ES2016 JavaScript files so that we can track our progress toward the ES2016 standard, and it would be nice for that to be mapped within electron-compile as well.
The text was updated successfully, but these errors were encountered:
I'd like for electron-compile to support CJSX. I rebased #57 on top of
master
but found that it still didn't work. The problem is that therequire-hook
only maps extensions to compilers based on the mime-types database (https://github.com/electron/electron-compile/blob/master/src/require-hook.js#L13), and the mime database does not include an entry fortext/cjsx
:If you log the values of
ext
, it looks like this. Note that text/cjsx is not the only compiler which is broken and not mapping to any file types.text/tsx
is also not mapping to anything.Technically, I could submit a PR to https://github.com/jshttp/mime-db to get
text/cjsx
in there, but they encourage contributors to submit new mimetypes to the governing body according to RFC 6838 section 5. I could do that, but it'd probably take a while, and then we'd have to get a chain of dependencies updated to support it.I think it would be very preferable to replace all this with a lookup table of extensions to mimetypes. This would also allow for custom mappings - in N1, we use
.es6
for ES2016 JavaScript files so that we can track our progress toward the ES2016 standard, and it would be nice for that to be mapped within electron-compile as well.The text was updated successfully, but these errors were encountered: