Skip to content
This repository has been archived by the owner on Dec 7, 2022. It is now read-only.

Making the npm module requireable #291

Closed
zeke opened this issue Jul 6, 2016 · 8 comments
Closed

Making the npm module requireable #291

zeke opened this issue Jul 6, 2016 · 8 comments
Labels

Comments

@zeke
Copy link

zeke commented Jul 6, 2016

👋

I'm working with @jlord and @kevinsawicki to incorporate accessibility audits into spectron and devtron, two development and testing tools for electron.

I see that this package is published to npm, but when I try to require it, I get errors:

❯ node -v                                
v6.2.2

~/electron/devtron accessibility
❯ trymodule accessibility-developer-tools
Gonna start a REPL with packages installed and loaded for you
Couldn't find 'accessibility-developer-tools' locally, gonna download it now
/Users/zeke/.trymodule/node_modules/accessibility-developer-tools/src/js/Audit.js:15
goog.require('axs.AuditResults');
^

ReferenceError: goog is not defined
    at Object.<anonymous> (/Users/zeke/.trymodule/node_modules/accessibility-developer-tools/src/js/Audit.js:15:1)
    at Module._compile (module.js:541:32)
    at Object.Module._extensions..js (module.js:550:10)
    at Module.load (module.js:458:32)
    at tryModuleLoad (module.js:417:12)
    at Function.Module._load (module.js:409:3)
    at Module.require (module.js:468:17)
    at require (internal/module.js:20:19)
    at npmi (/usr/local/lib/node_modules/trymodule/index.js:43:31)
    at /usr/local/lib/node_modules/trymodule/node_modules/npmi/npmi.js:42:24

Is this the expected behavior? What would it take to make the module work with require?

@zeke
Copy link
Author

zeke commented Jul 8, 2016

cc @alice and @addyosmani

@ajuste
Copy link

ajuste commented Aug 1, 2016

@zeke I just cloned the repo and when I run grunt I've similar warning

Warning: ./src/js/AuditResults.js:36: ERROR - variable goog is undeclared
goog.exportSymbol('axs.AuditResults', axs.AuditResults);
^

1 error(s), 0 warning(s)
 Use --force to continue.

Then I rebuild using --force argument and running the tests; which goes wrong:

arning: 307/322 assertions failed (432ms) Used --force, continuing.
Warning: Task "qunit:all" failed. Used --force, continuing

@addyosmani
Copy link
Member

Sorry for taking a while to get back to this (it didn't show up in my GH notifications). The above errors you are getting sound like closure compiler errors. I have a feeling something slipped when the last build in https://github.com/GoogleChrome/accessibility-developer-tools/tree/master/dist/js was generated and that's probably the first place we'll want to take a look at fixing.

Are you still actively exploring adding in support for this module?

@zeke
Copy link
Author

zeke commented Sep 1, 2016

Are you still actively exploring adding in support for this module?

@addyosmani yes. We are using it on some Electron projects and would love to be able to require this module instead of vendoring an unversioned ax.js file

@ajuste
Copy link

ajuste commented Sep 1, 2016

+1

@philschatz
Copy link
Contributor

👋 Howdy! I ran into this problem as well and created a fix at #298. The ./dist/js file seemed to work fine, but package.json did not point to it. I am probably missing something obvious but it fixed the problem for me.

Hope that helps!

@addyosmani
Copy link
Member

Thanks to @philschatz this should now be possible in master. Could folks that wanted this test out the latest version and let us know if you run into any trouble at all require'ing the module?

@zeke
Copy link
Author

zeke commented Oct 11, 2016

Thanks @philschatz and @addyosmani for making this happen!

WIP update for Spectron: electron-userland/spectron#126

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants