Closed Morgul closed 3 years ago
I have this error and it would be really helpful to be working :(
I haven't had a chance to start digging into the output to understand why one works, and the other doesn't. My plan is to keep working on in it in the upcoming week.
Just an update (more for myself as a reminder when I get back to this). I've spent some time this afternoon digging into this, and comparing the Vue3 compiler output to the Vue2 one, they both output the script section identically:
import Vue from "vue";
const defaultExport = Vue.extend({
name: "SimpleVue",
data() {
return {
msg: "Hello!"
};
}
});
Whatever the bug is, it's actually at the Vue level; something about how Vue.extends
works in Vue2 vs Vue3. As a side note, I have not confirmed this works in Vue 3; that would be something to try as well; maybe this is just broken with how Snowpack's building the module to wrap an SFC?
Good news! looks like vue-loader
has the solution, I think:
https://github.com/vuejs/vue-loader/blob/master/lib/runtime/componentNormalizer.js#L17-L20
I've gotta figure out the most minimal way to shove this into the plugin, but I think it should fix this issue.
As a workaround, @mszekiel, you should be able to just stick .options
on the end, i.e.:
export default Vue.extend({
name: "SimpleVue",
data() {
return {
msg: "Hello!"
};
}
}).options;
That seemed to work in the brief test I just did. I'll work on a new version of the plugin with a proper fix shortly.
This is fixed in v0.2.0
, which was just published.
Attempting to follow the Vue Typescript Guide leads to declaring a sample component like this:
However, compiling this with
snowpack-plugin-vue2
yields the following error message: