-
Notifications
You must be signed in to change notification settings - Fork 597
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
Build for UMD #617
Build for UMD #617
Conversation
8 characters. See choojs#537
https://github.com/choojs/choo-umd existed to do this, but what is your use case? I'm more 👎 on UMDs than I ever have been. EDIT: I've softened up on them since writing the above. People should till be bundling but we can still support this path. |
I'd note that this has little-to-no impact on the build size and changes nothing other than allowing one to include choo in a script tag, which I'd argue is a great thing 🎉 There's no extra file generated, etc, etc. |
We never actually use This is something I'd love to do in the next release of choo -- xhr was already dropped; I don't feel there is a significant advantage gain to including bel. |
For reference, I saw significant gains (well, losses) evicting both nanorouter (which is easy enough to re-implement) and choo/html. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think we should drop choo-umd and instead only have this
Would this cause conflicts when using |
@YerkoPalma yeah, it would. Might need to alias choo before importing devtools. Maybe we should alias devtools if it already detects a globl choo instance. A PR for that would be very welcome! |
I guess we could uppercase Choo here? |
I prefer uppercasing choo ( |
@YerkoPalma I'm still advocating evicting
with devtools extending Choo if it already exists |
package.json
Outdated
@@ -13,7 +13,7 @@ | |||
"example" | |||
], | |||
"scripts": { | |||
"build": "mkdir -p dist/ && browserify index -p bundle-collapser/plugin > dist/bundle.js && browserify index -p tinyify > dist/bundle.min.js && cat dist/bundle.min.js | gzip --best --stdout | wc -c | pretty-bytes", | |||
"build": "mkdir -p dist/ && browserify index -s choo -p bundle-collapser/plugin > dist/bundle.js && browserify index -p tinyify > dist/bundle.min.js && cat dist/bundle.min.js | gzip --best --stdout | wc -c | pretty-bytes", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this be uppercased to Choo
to avoid issues with devtools?
@heyitsmeuralex do you have time to address @YerkoPalma's review soon? i can do it too if not. |
index.js
Outdated
@@ -13,6 +13,9 @@ var xtend = require('xtend') | |||
|
|||
module.exports = Choo | |||
|
|||
Choo.html = require('./html') | |||
Choo.raw = require('./html/raw') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will add choo/html to yo-yoified browserify bundles too, increasing bundle size by a few KB… I think people should probably use nanohtml
directly instead for UMD, or we could have a separate UMD entry file that does something like
module.exports = require('./')
module.exports.html = require('./html')
module.exports.raw = require('./html/raw')
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. Reverting.
…state * upstream/master: 6.12.1 6.12.0 typings: add app to app.use cb (choojs#665) update dependencies (choojs#663) ci: Node 7 → Node 10 (choojs#661) Update bel and yo-yoify references in docs to nanohtml. (choojs#660) Build for UMD (choojs#617) 6.11.0 Use nanoassert in the browser (choojs#651) Switch to nanohtml (choojs#644) v6.11.0-preview1 choo components (choojs#639)
Via the
--standalone
browserify option.Fixes #537. Note that the export is
window.choo
.Only caveat is the
choo/html
is not exported -- the best way to do this would probably be to exportchoo.html
, but that'd require changes to the source also - see heyitsmeuralex/nanochoo for a potential solution to this (evictingchoo/html
altogether as it is unused within the choo source).