Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upQuestion: how do you handle file-wide IIFEs? #179
Comments
This comment has been minimized.
This comment has been minimized.
|
Maybe it's a silly suggestion, but couldn't the concat script be configured to inject a |
This comment has been minimized.
This comment has been minimized.
|
I usually write commonJS and use browserify to make a standalone UMD build when I need it, so this hasn't come up for me. If you're concerned about your users using a naive concatenation script, I would leave the ;(function () {
// code here
}()); // eslint-disable-lineI'll leave this issue open for a while in case others have ideas. |
This comment has been minimized.
This comment has been minimized.
Most smart concatenators would do something like this, but not all concatenators are smart. |
rstacruz commentedJul 1, 2015
You'll commonly see this pattern in frontend scripts, especially ones using the umd loader:
the semicolons are there to prevent oddities in concatenation with other scripts. you can keep the beginning
;, but not the ending;.is there a better workaround other than to resort to
// eslint-disable-line?