-
Notifications
You must be signed in to change notification settings - Fork 263
allow webpack to find common watchers #826
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
Conversation
|
Hey @shamrin, My thinking for embedded Eve programs was that users would manually require the watchers they're interested in using either their bundler's configuration file or an explicit import in their app. That said, I think it'd be a fantastic idea to build a starter framework targeting other bundlers such as webpack (just like Additionally, the floor is definitely open for discussion around this point. If there's a good cross-tooling way to make Eve dependency management easier, I'm all ears! |
|
@joshuafcole How does it break SystemJS loading? I've just tried How can I see the breakage?
Could you show an example? I was under impression that this patch doesn't really change anything. It's simply a hint for webpack, so that it would bundle all of I agree about Eve starter project for webpack. I'll try creating one. |
Forgive me, I had
Right, it's not that it changes anything compared to what the runtime previously did, it's that it isn't as flexible as the watcher loading system in the Since it doesn't explicitly break anything and is a relatively small change, I'm considering pulling it in anyway, even if it is webpack specific. While we think on it, if this PR effects you in any way, please voice your opinions. |
|
I'm also not very satisfied with In addition, I still don't understand watcher loading system advantages. For example, import {Program, html} from "witheve";
let program = Program("test");
program.attach(html);Or: import {Program} from "witheve";
import {html} from "witheve/watchers";
let program = Program("test");
program.attach(html);Attaching second- or third-party watcher becomes trivial. You would just import the necessary module. As a bonus, it would solve webpack problem, because watcher modules would be externally exported. |
The primary advantage is that it doesn't require a module loader at all. That is, if you simply concatenated the watchers into your bundle all programs would still have access to those watchers. It also lets the editor know about third party watchers as a side benefit. Without it, you'd always have to write some javascript or do some configuration for the editor to find them.
While
Yes, but I'm not sure the registry is actually the core problem here. I think -- as you've identified -- that we need to explicitly export the first party watchers if they're going to live within the runtime module. That way it's a much simpler process to require them in whatever manner is most convenient for bundling. We've also discussed splitting them out into their own modules either separately or together. I think we'll want to move in that direction eventually, where you just use NPM to manage your watcher dependencies and require the ones you need. If you have specific arguments against keeping the registry though (rather than also exporting the watchers), now's a good time to discuss those. We have no commitment to that strategy until we release 0.3. |
|
Yes, registry is not the core of the problem. I will add explicit export of first party watchers to this PR.
Ok! Without the registry (but with plain modules):
I would love if we could do without module bundling/loading tools. However, we already need the module system to load
We already need to write some javascript to P.S. Please avoid splitting stuff into NPM modules if you can. Let's not repeat lodash module madness. If we want to save some bytes and not load unused watchers, we could use dynamic imports in SystemJS or tree-shaking in Rollup or Webpack. |
e9521da to
f3f5565
Compare
|
I've added explicit export of first party watchers. Also I've added related PR: witheve/eve-starter#9. (I could remove watcher loading system separately, if we would agree to do it.) |
|
@joshuafcole Could you please chime in on the latest state of this PR? It seems to be incontroversal. I haven't touched watcher loading system in any way. |
|
Hey @shamrin, sorry for the long delay, I've been a bit wrapped up in revamping our web presence since last week. This all looks pretty good. One small change I'd recommend is to export all the watchers together from I want to take the time to carefully read and respond to your other post, but fixing these presence issues is very urgent. I promise that no decisions will be made without reading and responding first! |
|
Hey @shamrin, Just wanted to follow up to see if you were still interested in pursuing this? If not, I can make the last few touchups and get it merged instead. I think it's a good idea which will help our non-systemJS users significantly. |
|
Yes, I'm still interested. I'll take a look at it this weekend. Sorry for the long delay! |
|
Not a problem! Let me know if there's anything I can do to help. |
Export all first party watcher classes. Fixes #826.
This change allows the following to work when bundling the application with webpack:
Without it I get the error in browser console: