Skip to content
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

[build]ES6 Bundle errors in browser with extending PolymerElement or mixin #3483

Closed
dman777 opened this issue Dec 29, 2019 · 1 comment
Closed

Comments

@dman777
Copy link

dman777 commented Dec 29, 2019

Using Polymer 3 with cli 1.9.11 on linux system.

I have a Polymer 3 app that works with no issues. But if I build and bundle it I am having issues when bundled. I am only doing es6 for now. I have no idea how to even go about trouble shooting this..pretty stuck.

Polymer.json

      "builds": [
        {
          "name": "es6-bundled",
          "browserCapabilities": [
            "es2015"
          ],
          "js": {
            "minify": false,
            "transformModulesToAmd": true
          },
          "css": {
            "minify": false
          },
          "html": {
            "minify": false
          },
          "bundle": true,
          "addServiceWorker": false
        }
      ],

Error in browser:

    all-items:formatted:211 Uncaught TypeError: (0 , _mainApp.PauseForRipple) is not a function
        at user-login.js? [sm]:4

Code from bundle:

    define(["../main-app.js"], function(_mainApp) {
        "use strict";
    
        class UserLogin extends (0,
        _mainApp.PauseForRipple)(_mainApp.PolymerElement) {
            static get template() {
                return _mainApp.html`
          <style>
            :host {
              display: flex;
              align-items: center;

Original code before build:

    import { PauseForRipple } from '../mixins/pause-for-ripple-mixin.js';
    
    class UserLogin extends PauseForRipple(PolymerElement) {
      static get template() {
        return html`
          <style>
            :host {
              display: flex;
              align-items: center;
              justify-content: center;

Update I then removed the mixin and now browser is complaining about caught TypeError: Class extends value undefined is not a constructor or null

with the code:


  class UserLogin extends _mainApp.PolymerElement {
    static get template() {
      return _mainApp.html`

Please, if anyone can fix this or tell me what I am doing wrong.

@dman777
Copy link
Author

dman777 commented Dec 29, 2019

Closing this.... the root cause is I had double import import './login/user-login.js'; in main-app.js.

@dman777 dman777 closed this as completed Dec 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant