Polymer / tools

Polymer Tools Monorepo
BSD 3-Clause "New" or "Revised" License
430 stars 200 forks source link

Cannot convert Polymer 2 starter-kit example successfully #2828

Open dsyrstad opened 6 years ago

dsyrstad commented 6 years ago

I tried to convert the Polymer 2 stater-kit example to Polymer 3 and it fails to load in the browser. I'm using

polymer --version: 1.7.7 node --version: v8.11.3 npm --version: 6.3.0 bower --version: 1.8.4 Ubuntu 16.04.1

I followed these instructions to create the Polymer 2 start-kit app: https://www.polymer-project.org/2.0/start/toolbox/set-up

mkdir polymer2-3-upgrade-app
cd polymer2-3-upgrade-app
polymer init

I chose polymer-2-starter-kit

When I ran: polymer serve, it worked fine. I was up and running with Polymer 2 successfully.

Then I followed this guide: https://www.polymer-project.org/3.0/docs/upgrade to convert to Polymer 3:

modulizer --out . --npm-version 1.0.0 (Omitted --import-style name as recommended for application projects.)

[1/2] 🌀  Converting Package...
Out directory: /home/dsyrstad/IdeaProjects/polymer2-3-upgrade-app
Failed to read entrypoints of package 'shadycss' because the package does not have a 'bower.json' file.
polymer-starter-kit: Did not find an HTML main in bower.json. A main was not added to package.json, so this package will not be directly importable by name. Manually update main in your bower.json or package.json to fix.
[2/2] 🎉  Conversion Complete!

Then I ran: npm install

Which told me:

npm WARN deprecated formatio@1.1.1: This package is unmaintained. Use @sinonjs/formatio instead
npm WARN polymer-starter-kit@1.0.0 No repository field.

added 65 packages from 482 contributors and audited 575 packages in 4.091s
found 4 vulnerabilities (3 low, 1 critical)
  run `npm audit fix` to fix them, or `npm audit` for details

It appeared the conversion basically worked, so I ran: polymer serve I opened http://127.0.0.1:8081 in Chrome. Chrome Dev console reported:

webcomponents-loader.js:1 Failed to load resource: the server responded with a status of 404 (Not Found)
polymer-element.js:1 Failed to load resource: the server responded with a status of 404 (Not Found)
app-drawer.js:1 Failed to load resource: the server responded with a status of 404 (Not Found)
app-drawer-layout.js:1 Failed to load resource: the server responded with a status of 404 (Not Found)
app-header.js:1 Failed to load resource: the server responded with a status of 404 (Not Found)
app-header-layout.js:1 Failed to load resource: the server responded with a status of 404 (Not Found)
app-scroll-effects.js:1 Failed to load resource: the server responded with a status of 404 (Not Found)
app-toolbar.js:1 Failed to load resource: the server responded with a status of 404 (Not Found)
app-location.js:1 Failed to load resource: the server responded with a status of 404 (Not Found)
app-route.js:1 Failed to load resource: the server responded with a status of 404 (Not Found)
iron-pages.js:1 Failed to load resource: the server responded with a status of 404 (Not Found)
iron-selector.js:1 Failed to load resource: the server responded with a status of 404 (Not Found)
paper-icon-button.js:1 Failed to load resource: the server responded with a status of 404 (Not Found)
settings.js:1 Failed to load resource: the server responded with a status of 404 (Not Found)
html-tag.js:1 Failed to load resource: the server responded with a status of 404 (Not Found)
import-href.js:1 Failed to load resource: the server responded with a status of 404 (Not Found)

Only index.html, my-*.js, and service-worker.js were loaded by the browser. None of the node_modules loaded, probably because of imports like this:

import { PolymerElement } from '../../@polymer/polymer/polymer-element.js';

And this line in index.html:

<script src="../@webcomponents/webcomponentsjs/webcomponents-loader.js"></script>

Also tried:

polymer serve --npm
polymer serve --npm --module-resolution="node"
polymer serve --npm --module-resolution="none"
polymer serve --module-resolution="none"

All give the same result.

Help? I also commented on issue #459. I cannot get my current Polymer 2 app to convert because of spread operators.

drich1402 commented 5 years ago

Is there any solution?

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.