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

2.16.0 this._recompute is not a function #2049

Closed
thgh opened this issue Feb 4, 2019 · 0 comments
Closed

2.16.0 this._recompute is not a function #2049

thgh opened this issue Feb 4, 2019 · 0 comments

Comments

@thgh
Copy link
Contributor

thgh commented Feb 4, 2019

Component:

<h1>Hello {name}</h1>
<script>
  export default {
    tag: 'my-app',
    props: ['name']
  }
</script>

Compiled with

npx svelte@2 compile MyApp.html --customElement --output MyApp.js

In use:

<my-app name="world"></my-app>
<script type="module" src="./MyApp.js"></script>
or
<my-app name="world"></my-app>
<script type="module">
  import './MyApp.js'
</script>
or
<script type="module">
  import './MyApp.js'
  document.body.innerHTML = '<my-app name="world">'
</script>

All give the same error in: Chrome 71.0.3578.98 & Firefox 65 & Safari 12.0.3

VM569 MyApp.js:202 Uncaught TypeError: this._recompute is not a function
    at HTMLElement._set (VM569 MyApp.js:202)
    at HTMLElement.set (VM569 MyApp.js:183)
    at HTMLElement.attributeChangedCallback (VM569 MyApp.js:64)
    at VM569 MyApp.js:85

Actual generated code:

...
MyApp.prototype._recompute = noop;
customElements.define("my-app", MyApp);
...

Expected (or at least working) code:

...
customElements.define("my-app", MyApp);
MyApp.prototype._recompute = noop;
...

Related line of code:

` : (!sharedPath && `${name}.prototype._recompute = @noop;`)}

(this bug blocks a proper answer for #2033)

thgh added a commit to thgh/svelte that referenced this issue Feb 5, 2019
thgh added a commit to thgh/svelte that referenced this issue Feb 5, 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

2 participants