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

Initial documention for usage with webpack #58

Merged
merged 1 commit into from
Sep 23, 2016

Conversation

johnsusi
Copy link
Contributor

Got webpack working with clearwater and might as well document the procedure. :)

Initial documention for usage with webpack
@jgaskins
Copy link
Member

This is great!

I want to address that issue requiring setting global.virtualDom. It's probably due to compiling virtual-dom with Browserify right now. I've tried a couple different things where I compiled the JS with Webpack/Babel, such as #48 and a couple experiments where I swapped out virtual-dom with inferno and snabbdom and used Webpack for all of that. Everything worked just fine when I tried it. I have no idea why it worked — maybe Opal requires play nice with UMD-style requires?

Anyway, if we move away from the Browserify compilation and merge in the Webpack config used in #48 (even if that PR itself isn't merged in), that problem might go away. I'll go ahead and merge this, though. 🎉

@jgaskins jgaskins merged commit b3fc50b into clearwater-rb:master Sep 23, 2016
@johnsusi
Copy link
Contributor Author

That reminds me; I used a virtual-dom from npm, not the one bundled with clearwater. That might be an issue if you have applied patches to it?

I think the main issue is that some javascript libraries detect if they are in a browser environment or not. Most libraries that I have tried identify that they are running under node when using webpack and thus use commonjs requires.

There is no way for webpack to figure out that require 'clearwater/virtual_dom/js/virtual_dom.js'
should be transpiled to global.virtualDom = require('./clearwater/virtual_dom/js/virtual_dom.js').

I'm new to webpack so there might be some way to configure webpack to solve this.

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