npm init
npm install @polymer/polymer
import com.vaadin.flow.component.Component;
import com.vaadin.flow.component.Tag;
import com.vaadin.flow.component.dependency.JsModule;
import com.vaadin.flow.router.Route;
import com.vaadin.flow.server.PWA;
import com.vaadin.flow.theme.Theme;
@Tag("my-custom-element")
@JsModule("@polymer/polymer/polymer-element.js")
public class MyCustomElement extends Component {
public MyCustomElement() {
setText("Hello, custom element!");
}
}
script
const { merge } = require('webpack-merge');
const { PolymerProject, HtmlSplitter } = require('polymer-build');
const polymerProject = new PolymerProject({
entrypoint: 'src/my-custom-element.html',
shell: 'src/my-app.html',
sources: [
'src/**/*',
'node_modules/**/*'
]
});
const htmlSplitter = new HtmlSplitter();
module.exports = merge(polymerProject.config, {
module: {
rules: [
{
test: /\.html$/,
loader: 'polymer-webpack-loader'
}
]
},
resolve: {
extensions: ['.js', '.html']
},
plugins: [
htmlSplitter
]
});
npx webpack