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

theme.register is not a function #3

Closed
mvysny opened this issue Nov 3, 2020 · 2 comments · Fixed by #4
Closed

theme.register is not a function #3

mvysny opened this issue Nov 3, 2020 · 2 comments · Fixed by #4

Comments

@mvysny
Copy link

mvysny commented Nov 3, 2020

Using vcf-progress-spinner in a simple Vaadin project makes the javascript throw an exception when built in production mode:

Uncaught TypeError: theme.register is not a function
    <anonymous> http://localhost:8080/VAADIN/build/vaadin-bundle-2be600b9349182885bea.cache.js:34470
    __webpack_require__ http://localhost:8080/VAADIN/build/vaadin-bundle-2be600b9349182885bea.cache.js:64
    <anonymous> http://localhost:8080/VAADIN/build/vaadin-bundle-2be600b9349182885bea.cache.js:34958
    __webpack_require__ http://localhost:8080/VAADIN/build/vaadin-bundle-2be600b9349182885bea.cache.js:64
    <anonymous> http://localhost:8080/VAADIN/build/vaadin-bundle-2be600b9349182885bea.cache.js:199
    <anonymous> http://localhost:8080/VAADIN/build/vaadin-bundle-2be600b9349182885bea.cache.js:202

The stacktrace points to the following deobfuscated webpack code:

/***/ }),
/* 187 */,
/* 188 */
/***/ (function(module, exports) {

var theme = document.createElement('dom-module');
theme.id = 'vcf-progress-spinner-lumo';
theme.setAttribute('theme-for', 'vcf-progress-spinner');
theme.innerHTML = `
    <template>
      <style>
        :host {}
      </style>
    </template>
  `;
theme.register(theme.id);

Looks like a polymer import is missing.

TatuLund added a commit that referenced this issue Nov 10, 2020
niiyeboah pushed a commit that referenced this issue Nov 16, 2020
@niiyeboah niiyeboah reopened this Nov 16, 2020
@niiyeboah
Copy link

I have updated this codebase and used the latest vcf-element template. In the process I removed the unnecessary style module that was causing the error reported here. @mvysny could you test with v1.1.0 and confirm that this issue is resolved?

@mvysny
Copy link
Author

mvysny commented Nov 19, 2020

Using v1.1.0 is working for me, thanks! 👍

This code works for me, while failing previously:

@Route("")
@PWA(name = "Project Base for Vaadin", shortName = "Project Base")
class MainView : KComposite() {
    private val root = ui {
        verticalLayout {
            add(VcfProgressSpinner())
        }
    }
}

@NpmPackage(value = "@vaadin-component-factory/vcf-progress-spinner", version = "1.1.0")
@JsModule("@vaadin-component-factory/vcf-progress-spinner")
@Tag("vcf-progress-spinner")
class VcfProgressSpinner : Component()

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

Successfully merging a pull request may close this issue.

2 participants