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

node binding is loaded into the electron browser #54

Open

Description

@alexisvincent

When spawning an electron window, systemjs-babel-node.js is loaded instead of systemjs-babel-browser.js. Think this is because the environment is being detected as node instead of browser.

Activity

  1. alexisvincent commented on Jul 21, 2016

    @alexisvincent
    Author

    Specifically this error is thrown

    undefined:1 Uncaught (in promise) Error: (SystemJS) http://localhost:3000/jspm_packages/npm/systemjs-plugin-babel@0.0.12/systemjs-babel-node.js:26786
          var terminator = argv.indexOf('--');
                               ^
        TypeError: Cannot read property 'indexOf' of undefined
    
  2. alexisvincent commented on Jul 21, 2016

    @alexisvincent
    Author

    @guybedford can get around with

    SystemJS.config({
      "packages": {
        "npm:systemjs-plugin-babel@0.0.12": {
          map: {
            "systemjs-babel-build": "./systemjs-babel-browser.js",
          }
        }
      }
    });
    

    But then hit an issue with process not being defined

  3. guybedford commented on Jul 21, 2016

    @guybedford
    Member
  4. guybedford commented on Jul 21, 2016

    @guybedford
    Member

    What version of Node are you using?

  5. alexisvincent commented on Jul 21, 2016

    @alexisvincent
    Author
    undefined:1 Uncaught (in promise) Error: (SystemJS) http://localhost:3000/jspm_packages/github/jspm/nodelibs-process@0.2.0-alpha/process-node.js:3
        var pEnv = process.env;
                          ^
        TypeError: Cannot read property 'env' of undefined
    
  6. alexisvincent commented on Jul 21, 2016

    @alexisvincent
    Author

    which is strange, because when I evaluate window.process i get an object back

  7. alexisvincent commented on Jul 21, 2016

    @alexisvincent
    Author

    v6.3.0 however I think issue is on v5 as well, let me check

  8. alexisvincent commented on Jul 21, 2016

    @alexisvincent
    Author

    Yep, same issue on v5.2.0

  9. guybedford commented on Jul 21, 2016

    @guybedford
    Member

    You can also check the value of System.import('@node/process').then(function(m) { var process = m.default })... which should be the process object, and if not that is a SystemJS bug in Electron.

  10. alexisvincent commented on Jul 21, 2016

    @alexisvincent
    Author

    Uncaught (in promise) TypeError: Cannot read property 'default' of undefined

  11. alexisvincent commented on Jul 21, 2016

    @alexisvincent
    Author

    I hope this isn't my setup. I took an existing JSPM 17 app, and just put it in electron. Checked it and it works outside of electron via the same port

  12. guybedford commented on Jul 22, 2016

    @guybedford
    Member

    @alexisvincent I just ran the electron quickstart app and then did System.import('@node/process').then(console.log.bind(console)) and am definitely seeing the right process logged. What mode would I need to run Electron in to reproduce this?

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions