Polymer 3 without Polymer CLI

861 Views Asked by At

I'm trying Polymer 3, and i'm asking a question. Is it possible to try it (or to build a complete app) without using Polymer CLI?

After searching, I think that it's not really possible because of using package names in my imports.

As the documentation say : "Using package names in your imports makes it easier to install third-party dependencies, and removes the need to juggle the different path styles of elements and applications. Previously, for example, you had to import the Polymer library from ./node_modules/@polymer/polymer/polymer-element.js in apps, and from ../@polymer/polymer/polymer-element.js in reusable elements. Now, apps and reusable elements can both import from @polymer/polymer/polymer-element.js.

The Polymer CLI tools automatically resolve and rewrite imports that use package names to imports that use paths, producing web-compatible code for the browser."

Is there any solution to use Polymer 3 without Polymer CLI ?

thanks a lot

5

There are 5 best solutions below

0
mindon On

you can. use the polymer-cli build the demo first, then use the code inside build/dev/ directly - but you need to manage everything manual after then...

0
Swift On

The Polymer PWA has a Webpack branch that does not use the CLI i think https://github.com/Polymer/pwa-starter-kit/tree/webpack

0
bloo On

Polymer 3 can indeed be developed without the Polymer CLI, however you do still need to transpile you application down to resolve imports. From what I understand, webpack is quite able to do this. In fact, webpack is a transpiler built into angular CLI so Polymer 3 can intergrate really nicely with Angular applications also.

If you're aiming at creating completely independent components like 'paper-element' I think you'd have to build each component seperately with webpack.

Worth noting is that, developing in typescript will become much easier one you figure out how to bundle your project with webpack.

1
Yunus ER On

You can serve a Polymer app using any server technology you want.But you need Polymer CLI for develop. I'm using Apache Server for serve my Polymer Web Page.To do this, I just need to put the build file into Apache.

Check Polymer 3.0 Build for Production to know how it is done;

0
Jeremy Bernier On

You can use webpack. Here's a sample repo I made of LitElement with a basic webpack config with Babel and decorator support: https://github.com/JeremyBernier/lit-element-webpack-hello-world