electron-userland / electron-compilers

DEPRECATED: Compiler implementations for electron-compile
35 stars 55 forks source link

creating a default name #64

Closed mbalex99 closed 7 years ago

mbalex99 commented 7 years ago
  1. This will create a _default ID if the module has a default export
  2. This will addHotModuleLoadingRegistration only if `builtInOpts.hotModuleReload == true)
fasterthanlime commented 7 years ago

I think I just ran into this:

unexpected-comma-indeed

Any timeline on the merge @paulcbetts ? Or am I better off starting to refactor out default exports of react components in my codebase :)

edit: using a fork to get that PR for now, no pressure 🌟

anaisbetts commented 7 years ago

This is electron-compilers 5.8.1 - thanks for the PR @mbalex99!

mbalex99 commented 7 years ago

Yuck we should have written extensive tests for this. My apologies... On Tue, Apr 25, 2017 at 9:31 AM Amos Wenger notifications@github.com wrote:

@fasterthanlime commented on this pull request.

In src/js/typescript.js https://github.com/electron/electron-compilers/pull/64#discussion_r113245117 :

@@ -81,9 +81,11 @@ export default class TypeScriptCompiler extends SimpleCompilerBase { addHotModuleLoadingRegistration(sourceCode, fileName, exports) { if (exports.length < 1) return sourceCode;

  • let registrations = exports.map(x =>
  • __REACT_HOT_LOADER__.register(${x}, "${x}", __FILENAME__);\n
  • );
  • let registrations = exports.map(x => {
  • let id = ${x} == 'default' ? "_default" : ${x}

So, I upgraded to the latest electron-compilers (away from my fork) and.. for some reason, with typescript & es2017 target, this breaks. I'm not really sure what happened, maybe some caching foiled my earlier testing?

Anyhoo it works replacing "_default" with "exports.default", but that depends on the typescript module target I suppose. I'd make a PR but who knows if that'd break it for someone else?

Note that I'm using passthrough for "text/javascript" (without that, electron-compile was trying to process my entire node_modules it seems!)

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/electron/electron-compilers/pull/64#discussion_r113245117, or mute the thread https://github.com/notifications/unsubscribe-auth/ACFSMeFe6UIn4jrocJf4gTUNRSREYsSRks5rzh_igaJpZM4MdEzK .

-- Maximilian Alexander mbalex99@gmail.com www.maxofeden.com