Closed jorgedavila25 closed 6 years ago
Hey, thanks for the feedback.
I'm not a big expert on everything closure compiler related as I created this loader specifically to get rid of the closure compiler back in the day when I first created it (the project does not longer exist), so I can't fully answer your question.
That beeing said, this loader merely replaces goog.provide
and goog.require
with their node counterparts (module.export
and require()
) with some added namespacing. Thus file be be seen as a module by webpack and thus has its own scope. goog.scope
isn't necessary for the actual scoping, as every file is a normal webpack module (like any other regular module in webpack) but the loader doesn't do any of the inlining of aliases etc. that the compiler seems to do within such a scope (this would fall to whatever minification you do with our code).
This loader is generally compatible with the closure library, though every now an then some modules seem to have problems. There were some pull requests (and some are still opened where I sadly haven't come around to check them yet) to fix some of the issues though and you need to add special configuration for that.
As of support for the compiler itself (is there a webpack loader or plugin for that?): I have no idea. I think it should be compatible, but I have never tried myself (and to be honest: I don't intend on doing that).
Thanks for the response! I'll close this issue, but def helpful. thanks again
Hi,
To start off, thank you for this loader. Has been very helpful so far. I've never used Closure and just recently inherited a program that uses Closure and now looking to build it via Webpack (currently builds with Bazel). In the source code, there's a lot of :
goog.provide()
andgoog.require()
both which seem to be supported by this project. The only difference that I see in the project that I'm working on is that after
goog.provide
andgood.require
, the implementation is wrapped in scope. e.g.Does this library use of JS modules make this goog.scope obsolete? If not, is there a way to use it via the Closure library that's included?
Also, a bit different, but I'm not really sure how this project fits with the google closure compiler. Theoretically speaking, is this all I need to have a functioning JS app with Closure Library without the need of the compiler? Is the compiler merely an optimizer?
Thanks in advance!!