Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible missing module.exports in compressed file #955

Closed
justingeeslin opened this issue Feb 28, 2017 · 5 comments
Closed

Possible missing module.exports in compressed file #955

justingeeslin opened this issue Feb 28, 2017 · 5 comments

Comments

@justingeeslin
Copy link
Contributor

I noticed that blocky_uncompressed.js has a module.exports = Blockly while blocky_compressed.js does not have any module exports. Is this intentional -or might it be stripped out by the (closure) compiler by mistake?

@AnmAtAnm
Copy link
Contributor

This is intentionally added by our build.py script, which is how we generate our _uncompressed and _compressed files.

build.py, line 149

if (isNodeJS) {
  window.BLOCKLY_BOOT()
  module.exports = Blockly;

(Looks like we're missing a semicolon.)

@justingeeslin
Copy link
Contributor Author

Why is module.exports not present in the compressed file? Should only the uncompressed and not the compressed file be used when required using npm? Seems like these two files should be equivalent to one another..

@AnmAtAnm AnmAtAnm reopened this Feb 28, 2017
@AnmAtAnm
Copy link
Contributor

I see the code in question is just within the Gen_uncompressed class. I'm going to have to ask @carlosperate to chime in, since he added that. #237

If I may guess, in a node build environment, it makes little sense to run the compressed version. This is the one your are developing with and might want to track back to legible line numbers. Most often, the client-side code included in the NPM dependencies will be repackaged, including their own compression pass, with all included libraries.

@carlosperate
Copy link
Contributor

Well, that specific PR was just adding an extra check to the existing isNodeJS flag, which was only present in the uncompressed version.
I've not really used headless blockly with node itself (the PR problem was that when a page with blockly was loaded in an electron "window" the old flag incorrectly though it was running in node), so I am not quite sure why the same wasn't also injected into the compressed version. The original PR adding this bit was #209.

@samelhusseini
Copy link
Contributor

Our built files are now packaged into UMD modules which add the module.exports in there. Closing this issue.

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

No branches or pull requests

4 participants