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

Add browserify and build-global script to make UMD version #861

Closed
wants to merge 1 commit into from

Conversation

trusktr
Copy link

@trusktr trusktr commented Mar 27, 2017

No description provided.

Copy link
Member

@ljharb ljharb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is something that is very intentionally not included in enzyme. Everything should only be available as node-style CJS; users of other module formats should convert on their own.

@trusktr trusktr mentioned this pull request Mar 27, 2017
@ljharb
Copy link
Member

ljharb commented Mar 27, 2017

See #858, #806, and #264 for why this is not desired.

@ljharb ljharb closed this Mar 27, 2017
@trusktr
Copy link
Author

trusktr commented Mar 27, 2017

Everything should only be available as node-style CJS

I strongly disagree. There's plenty of people out there that use plain JavaScript (script tags) with react and no JSX. It's unfair to treat everyone as skilled in module bundler tools.

I strongly believe library authors can take extra care to make sure their library is as consumable as possible so other people can simply plop the library into their project and have it simply work.

As you see in #47 (which also applies to browserify), it's not as simple as just "go build this with webpack or browserify" because... it fails in ways that most people probably don't even know how to deal with when using webpack and browserify in standard ways, otherwise #47 wouldn't exist.

@ljharb
Copy link
Member

ljharb commented Mar 27, 2017

I strongly believe library authors can take extra care to make sure their library is as consumable as possible so other people can simply plop the library into their project and have it simply work.
I totally agree with this sentiment.

However, enzyme is not a production library - it's a testing library. People still using script tags are unlikely to even be writing tests at all, let alone trying to run them in the browser.

It's 2017. Everyone needs to become skilled in module bundler tools - it's how modern web dev is done, full stop. It's not doing anyone any favors to make it easier for them to remain in the stone ages.

@trusktr
Copy link
Author

trusktr commented Mar 27, 2017

Imagine a brand new programmer learning React, using globals, okay not using JSX for now, then wants to use this awesome "enzyme" test tool to test out a component. That user will be stuck without being able to experience the awesome, unless they now stop what they're doing and go learn build tools (which isn't a bad thing, but maybe not what they wanted to do at that moment, and maybe not what they are capable of yet, you'd be surprised how many people start programming and making awesome things without even knowing how the filesystem or command line works).

As library authors, IMHO we should strive to make the end-user experience as easy as possible, as accessible as possible. In this case, shipping a global version would help.

@trusktr
Copy link
Author

trusktr commented Mar 27, 2017

it's how modern web dev is done, full stop

In companies, probably yes.

Someone learning JavaScript with the plethora of online web-based in-browser editors out there? Not necessarily.

That's besides the point. I am familiar with build tools, however I really do enjoy being able to open a website like jsfiddle, plopping a <script> up in that thing, and getting to coding small examples without worrying about a build tool.

Suppose I'd like to test out a test library in jsfiddle, for example. It's relatively easy for a library author to ship a global. The time that it takes to do that gets distributed to one person instead of many many users.

@trusktr
Copy link
Author

trusktr commented Mar 27, 2017

Suppose I'd like to show my friend, "hey, look how awesome this test tool enzyme is, here open this fiddle", and I was able to do it because of a simple global script tag. It's not always about build systems.

@ljharb
Copy link
Member

ljharb commented Mar 27, 2017

Also a fair point, and having a nice enzyme template jsfiddle would be super helpful.

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