Skip to content

Dynamically-assembled require() calls in lib/widget.js break pkg/nexe support #298

@flofriday

Description

@flofriday

This is almost a clone from issue #158 however, browserify should now work and packaging tools like zeit-pkg don't. These packaging tools can't generate executables with Dynamically-assembled require() calls.

Working around wasn't difficult, just replace

widget.classes.forEach(function(name) {
  var file = name.toLowerCase();
  widget[name] = widget[file] = require('./widgets/' + file);
});

with

widget['Node'] = widget['node'] = require('./widgets/node');
widget['Screen'] = widget['screen'] = require('./widgets/screen');
widget['Element'] = widget['element'] = require('./widgets/element');
widget['Box'] = widget['box'] = require('./widgets/box');
....

Still, it would be nice if this would work by default.
Note: I just tested zeit-pkg but according to the documentation nexe can't deal with the original code either.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions