Polymer / shop

The Shop app
https://shop.polymer-project.org/
986 stars 494 forks source link

Unable polymer build #153

Closed mahdiridho closed 6 years ago

mahdiridho commented 6 years ago

Below is my polymer.json :

{
  "entrypoint": "index.html",
  "shell": "src/shop-app.html",
  "fragments": [
    "src/shop-list.html",
    "src/shop-detail.html",
    "src/shop-cart.html",
    "src/shop-checkout.html",
    "src/lazy-resources.html"
  ],
  "sources": [
    "src/**/*",
    "data/**/*",
    "images/**/*"
  ],
  "extraDependencies": [
    "manifest.json",
    "bower_components/webcomponentsjs/*"
  ],
  "lint": {
    "rules": ["polymer-2-hybrid"]
  },
  "builds": [
    {
      "preset": "es5-bundled",
      "name": "es5-bundled",
      "bundle": true,
      "js": {"compile": true, "minify": true},
      "css": {"minify": true},
      "html": {"minify": true},
      "addServiceWorker": true,
      "addPushManifest": true,
      "insertPrefetchLinks": true
    },
    {
      "preset": "es6-bundled",
      "name": "es6-bundled",
      "bundle": true,
      "js": {"compile": false, "minify": true},
      "css": {"minify": true},
      "html": {"minify": true},
      "addServiceWorker": true,
      "addPushManifest": true,
      "insertPrefetchLinks": true
    },
    {
      "preset": "es6-unbundled",
      "name": "es6-unbundled",
      "bundle": false,
      "js": {"compile": false, "minify": true},
      "css": {"minify": true},
      "html": {"minify": true},
      "addServiceWorker": true,
      "addPushManifest": true,
      "insertPrefetchLinks": true
    }
  ]
}

When I run polymer build, it shows error :

error: [cli.build.analyzer]   In src/shop-category-data.html: [unknown-superclass] - Unable to resolve superclass Polymer.Element
error: [cli.build.analyzer]   In src/shop-image.html: [unknown-superclass] - Unable to resolve superclass Polymer.Element
error: [cli.build.analyzer]   In src/shop-home.html: [unknown-superclass] - Unable to resolve superclass Polymer.Element
error: [cli.build.analyzer]   In src/shop-app.html: [unknown-superclass] - Unable to resolve superclass Polymer.Element
error: [cli.build.analyzer]   In src/shop-list-item.html: [unknown-superclass] - Unable to resolve superclass Polymer.Element
error: [cli.build.analyzer]   In src/shop-list.html: [unknown-superclass] - Unable to resolve superclass Polymer.Element
error: [cli.build.analyzer]   In src/shop-detail.html: [unknown-superclass] - Unable to resolve superclass Polymer.Element
error: [cli.build.analyzer]   In src/shop-cart.html: [unknown-superclass] - Unable to resolve superclass Polymer.Element
error: [cli.build.analyzer]   In src/shop-checkout.html: [unknown-superclass] - Unable to resolve superclass Polymer.Element
error: [cli.build.analyzer]   In src/shop-cart-data.html: [unknown-superclass] - Unable to resolve superclass Polymer.Element
error: [cli.build.analyzer]   In src/shop-snackbar.html: [unknown-superclass] - Unable to resolve superclass Polymer.Element
error: [cli.build.analyzer]   In src/shop-tabs-overlay.html: [unknown-superclass] - Unable to resolve superclass Polymer.Element
error: [cli.build.analyzer]   In src/shop-tab.html: [unknown-superclass] - Unable to resolve superclass Polymer.Element
error: [cli.build.analyzer]   In src/shop-network-warning.html: [unknown-superclass] - Unable to resolve superclass Polymer.Element
error: [cli.build.analyzer]   In src/shop-404-warning.html: [unknown-superclass] - Unable to resolve superclass Polymer.Element
error: [cli.build.analyzer]   In src/shop-cart-item.html: [unknown-superclass] - Unable to resolve superclass Polymer.Element
error:   Promise rejection: Error: 16 error(s) occurred during build.
error:   Error: 16 error(s) occurred during build.
    at BuildAnalyzer._done (/usr/local/lib/node_modules/polymer-cli/node_modules/polymer-build/lib/analyzer.js:241:36)
    at BuildAnalyzer.<anonymous> (/usr/local/lib/node_modules/polymer-cli/node_modules/polymer-build/lib/analyzer.js:201:26)
    at next (native)
    at fulfilled (/usr/local/lib/node_modules/polymer-cli/node_modules/polymer-build/lib/analyzer.js:17:58)
    at process._tickCallback (internal/process/next_tick.js:109:7)

I tried a solution from a similar issue, it modified the way of class call and add a polyfill comment like the following line :

/* @polymerMixin */
const ShopXXX = subclass = class extends Polymer.Element {

The polymer build is success

The question #1, Is there any other way to build them without modified the way of class call?

Next... After I build them and success, I tried run polymer serve on each folder build. I got many errors on browser console cannot found the element import, something like the following error :

GET http://localhost:8000/src/bower_components/polymer/polymer.html 404 (Not Found)

I checked the related file on build folder, the link of file import is missing after build to be :

bower_components/....

It should be :

../bower_components/....

The question #2, How to run polymer build without change the import link path?

Thank you!