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

name:false param for UMD wrapper #96

Open
jamesplease opened this issue Feb 3, 2015 · 10 comments
Open

name:false param for UMD wrapper #96

jamesplease opened this issue Feb 3, 2015 · 10 comments

Comments

@jamesplease
Copy link

Not all libraries export variables. For instance, if I'm writing a plugin for momentjs, I will likely just modify the moment library and not return anything.

Would you be willing to support a feature where the module doesn't export anything? For the UMD case, it might cause bugs if you just let the name go undefined, so maybe requiring an explicit false to be set would help prevent those problems while also adding in this functionality.

@jamesplease
Copy link
Author

Oh, you know what, I just tried typing a variable that isn't explicitly defined in the code ("moment") and it ended up returning nothing without any problems. That's a combination of awesome, because it does what I want it to do, but maybe not so awesome, 'cause that might be unexpected behavior.

Maybe the updated behavior should be:

  1. Throw an error if the variable doesn't exist
  2. Don't export anything if name is set to false.

@Rich-Harris
Copy link
Contributor

+1, I've been meaning to do this. I think the rule should be that if something is exported, you have to supply a name, otherwise the name will be ignored.

@jamesplease
Copy link
Author

Sounds good to me. Should I try to whip up a PR?

@Rich-Harris
Copy link
Contributor

That'd be great! Thanks. Shout if anything in the code doesn't make sense

@jamesplease
Copy link
Author

Shout if anything in the code doesn't make sense

Tabs? Tabs?

jkjkjk

😛

@eventualbuddha
Copy link
Contributor

I know, right? It isn't really the default choice these days. That said, if your editor has an EditorConfig plugin then you don't really have to even think about it.

@jamesplease
Copy link
Author

That said, if your editor has an EditorConfig plugin then you don't really have to even think about it.

Good point!

I was just messin' around, though 😉

@Rich-Harris
Copy link
Contributor

ldnwkgp

@jamesplease
Copy link
Author

looool

on another note...

template strings 😮 👐

@jamesplease
Copy link
Author

My favorite old hack – setting the name property to be a nonexistent variable – seems to no longer work to get around this. Shucks 😛

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

No branches or pull requests

3 participants