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

Fix UMD implementation #42

Merged
merged 3 commits into from
Jun 27, 2017
Merged

Fix UMD implementation #42

merged 3 commits into from
Jun 27, 2017

Conversation

doughsay
Copy link

@doughsay doughsay commented Jun 25, 2017

The current UMD header and footer prevent ansi_up from being used by webpack. The kind folks over at StackOverflow helped me out with my question. I used these UMD templates to come up with something that seems to work much better.

This will:

  • export the AnsiUp constructor to the browser as a gloabal.
  • allow webpack+babel or babel on its own to import it like this: import AnsiUp from 'ansi_up'
  • keep the same node behavior as before: const AnsiUp = require('ansi_up').default

@doughsay
Copy link
Author

Another thing to consider: technically we can make the node use-case easier too by changing the CommonJS section to:

var exp = {};
factory(exp);
module.exports = exp.default;

This would allow node usage to be const AnsiUp = require('ansi_up') without the need for .default

@drudru
Copy link
Owner

drudru commented Jun 25, 2017

Hi - thanks - will review and push/etc tomorrow.

@drudru drudru merged commit 7de540c into drudru:master Jun 27, 2017
@drudru
Copy link
Owner

drudru commented Jun 27, 2017

Thanks!

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

Successfully merging this pull request may close these issues.

2 participants