-
Notifications
You must be signed in to change notification settings - Fork 10
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
Future: Support Vue Single File Component, deprecate .vue.html compilation #123
Comments
Feature is implemented by #128 but compilation not yet enabled. |
Compilation was enabled in
Vue Export SpecificationIt appears that there are 3 known ways of exporting a Vue component: Plain Old JavaScript Objectexport default {
render: undefined,
staticRenderFns: undefined,
}; Output code is the same as input code Vue Extendimport Vue from 'vue'
export default Vue.extend({
render: undefined,
staticRenderFns: undefined,
}) Output code is the same as input code Vue Class ComponentInput: import Vue from 'vue';
import Component from 'vue-class-component';
@Component({
render: undefined,
staticRenderFns: undefined,
})
export default class extends Vue {
} Output: import * as tslib_1 from "tslib";
import Vue from 'vue';
import Component from 'vue-class-component';
var default_1 = /** @class */ (function (_super) {
tslib_1.__extends(default_1, _super);
function default_1() {
return _super !== null && _super.apply(this, arguments) || this;
}
default_1 = tslib_1.__decorate([
Component({
render: undefined,
staticRenderFns: undefined,
})
], default_1);
return default_1;
}(Vue));
export default default_1; |
Feature is live in The next release will wait for |
Obviously a breaking change. ☢️ 🚨
When
Currently vetur cannot provide intellisense for members of a component class. vuejs/vetur#145
Accelist dev team prefers the purity of current module ecosystem (TS, JS, HTML, JSON; hence the makeshift
.vue.html
file). However, this will change if suddenly vetur adds rich intellisense:instapack will be modified to enable
.vue
file compilation!.vue.html
file support will be deprecated.VS Code + Vetur will be the preferred IDE for developing a Single-Page Application.
and Auto-Close Tag extension.
and Auto-Rename Tag extension.
What
The below example reflects the new
vue
template if Vue Single Component compilation is supported. Currently:compiler
andframework
are not exposed by the vetur auto-complete.Hovering over
compiler
andframework
does not tell the data types of respective variables. Neither when using directives such asv-for
.Hello.vue
vue-shim.d.ts
Changes Required for the TS Build Tool
yarn add vue-loader -E
Changes Required for The TS Checker Tool
Include
.vue
files regardless it being imported or not. (We cannot detectimport
due tovue-shim.d.ts
)However we include them as
.vue.ts
to enable checks. Obviously, this file is imaginary / virtual / phantom.When reading the file, we read the
.vue
counterpart, strip all codes before<script lang="ts">
and strip all codes after</script>
This essentially turns the
.vue
file into a normal TypeScript file. That way, we can still check for errors in parallel with the actual compilation!In case there are future frameworks doing this kind of 💩 again, develop the feature as a plugin system.
The text was updated successfully, but these errors were encountered: