wired-elements icon indicating copy to clipboard operation
wired-elements copied to clipboard

Bundled version not working with Google Closure compiler

Open davclark opened this issue 5 years ago • 1 comments

I'm trying to use the bundled wired-elements with ClojureScript / shadow-cljs as part of a community project. shadow-cljs uses Google's Java-based closure compiler, and gives me the following error:

Closure compilation failed with 3 errors
--- node_modules/wired-elements/lib/wired-elements-bundled.js:2
Class names defined inside a function cannot be reassigned.
--- node_modules/wired-elements/lib/wired-elements-bundled.js:28
Class names defined inside a function cannot be reassigned.
--- node_modules/wired-elements/lib/wired-elements-bundled.js:984
Class names defined inside a function cannot be reassigned.

Each of these lines appears to be a definition of a CSS :host rule inside a template string... so I'm not sure what the issue really is, and it may be due to shadow-cljs. While my project is using shadow-cljs, it is structured as a fairly typical npm project if you want to try running it yourself. The project in question is in the scrape-n-mail directory (after installing dependencies w/ npm install, I get the above error using npm run watch for example):

https://github.com/davclark/maybe-buddha/tree/wired

While this doesn't seem insurmountable, I'm not famliar with how you bundle things and what the right plan of attack would be. I'm happy to try to work up a PR with some guidance on how to do that!

And if this seems like the fault of shadow-cljs, please let me know and I'll go bother those fine people.

davclark avatar Jun 01 '20 16:06 davclark

I know lit-element added support for Closure compiler, so there's a change things will work with the latest version. Try v2.1.0

pshihn avatar Jun 20 '20 06:06 pshihn