-
Notifications
You must be signed in to change notification settings - Fork 48
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
Polymer 3 Support #60
Comments
I have created an minimalistic repo where I try to use Polymer 3.0 paper-button (https://github.com/ed-ilyin/elmish-polymer). After webpack I'm getting an error BTW there is an example of compiled js: https://raw.githubusercontent.com/ed-ilyin/elmish-polymer/master/public/bundle.js |
@ed-ilyin Looks like something is bringing in the wrong version of |
Actualy this is through all the file. Everywhere where Polymer is referenced. |
I have created even smaller example: https://github.com/ed-ilyin/polymer3-webpack |
I've tried using this loader with LitElement (https://github.com/PolymerLabs/lit-element) importing Polymer "...html" files into the ES6 class file, but often getting complaints that something was already defined. So perhaps what needs to be addressed for Polymer 3 is to avoid defining custom elements multiple times especially as many components import a bunch of shared legacy components. Right now falling back to defining each required component on the global top level via HTML import in order to use in the Polymer 3 class works. |
It would be great to know where this project is at regarding Polymer 3.0 There's a good chance that people using Polymer with Webpack will end up in this repo because of this article (which was very helpful for getting us started with Polymer 2.0 - thank you). Depending on your current thinking, it might be worth putting a statement on the Readme about how this is currently for Polymer 2.0 and if you are using Polymer 3.0 try such and such etc (I'm still looking into it but it seems like we don't need a loader so much for Polymer 3.0). |
+1, is this project still being maintained? It's a must doing some postprocessing separating HTML, CSS, and JS. |
With Polymer 3, you don't need a loader. If you want to post-process HTML, then you're code will look like: import fooTemplate from './foo-element.html';
class FooElement extends Polymer.Element {
static get template() {
return fooTemplate;
}
} |
I know but that's not a valid file that can be published to the webcomponents repo, and would like to postprocess library files as well. |
Polymer 3 support added in #96 |
Not sure what I'm missing but I installed the latest version from NPM and when I use the config from the docs the build breaks. It only works when I have the test set to .html. package.json
"devDependencies": {
"polymer-webpack-loader": "^2.0.3",
} webpack.config.js
module: {
rules: [
{
test: /\.js$/,
use: 'polymer-webpack-loader'
},
]
}
|
Basic Support
For basic polymer 3 support - the relationship between JS and HTML will probably be reversed. Instead of HTML importing JS, the JS file will import HTML:
This relationship should not require a specialized loader and should just work with WebPack.
LitHtml in Separate File
For better static analysis and renaming support (especially with Closure-compiler), can a standard Polymer template be converted to Lit syntax by a loader?
This would continue to allow HTML authoring, but completely remove the need for projects like polymer-rename.
One of the shortcomings would be the apparent loss of the path-based change notification. This merits further investigation.
The text was updated successfully, but these errors were encountered: