-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
vue/ts - separation of concerns (vue-cli 3 beta 15) #1576
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
Comments
This does work, but only if you use a different filename for the .ts file
or put it in a separate directory.
…On Thu, 14 Jun 2018, 20:54 Ben Croughs, ***@***.***> wrote:
Version
3.0.0-beta.15
Reproduction link
https://codesandbox.io/s/j1wvnyn68w
Steps to reproduce
setup a new cli project using beta 15 & ui
add Test.vue
TEST
<script lang="ts"> export { default } from './Test'; </script>
add Test.ts
import Vue from 'vue';
import { Component } from 'vue-property-decorator';
@component <https://github.com/component>({
name: 'test',
components: {
},
})
export default class Test extends Vue {
}
and in the router change the home route to this test component or add
another router
What is expected?
that the page is rendered and test is displayed
What is actually happening?
componentNormalizer.js?2877:24 Uncaught TypeError: Cannot set property
'render' of undefined
at normalizeComponent (componentNormalizer.js?2877:24)
at eval (Test.vue?2500:8)
at Module../src/components/Test.vue (app.js:3768)
at *webpack_require* (app.js:722)
at fn (app.js:99)
at eval (index.ts:6)
at Module../src/router/index.ts (app.js:3816)
at *webpack_require* (app.js:722)
at fn (app.js:99)
at eval (main.ts:6)
------------------------------
when using the ts code inside the vue file it works as expected, but i
want to have a split vue and ts file
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#1576>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/AbCGJQN4EikD0fH73zDQ5BBnksDEb0o0ks5t8r-SgaJpZM4UokIH>
.
|
FYI you can just do |
hey thanks for the 2 answers both work, but you will also need to add the ts-loader as a dev dependency. What i find weird since alle webpack loaders were removed from the packages, could that mean that the ts-loader was not added when using the vue-ui ? |
If I try using Evan's solution I can no longer import the I've made a small repro to show the problem: https://github.com/coldino/test-vue-script-import
I didn't understand the comment about ts-loader needing to be added to the dev dependencies. It's already picked up indirectly via |
It seems that this issue is actually a duplicate of this one: #1104, and the source of the problem is found upstream in We already opened an issue, but a solution is not in immediate sight. A workaround is described here: TypeStrong/fork-ts-checker-webpack-plugin#111 (comment) Further discussion should be happening in the original issue. |
Version
3.0.0-beta.15
Reproduction link
https://codesandbox.io/s/j1wvnyn68w
Steps to reproduce
setup a new cli project using beta 15 & ui
add Test.vue
add Test.ts
and in the router change the home route to this test component or add another router
e.g. your app.ts
What is expected?
that the page is rendered and test is displayed
What is actually happening?
componentNormalizer.js?2877:24 Uncaught TypeError: Cannot set property 'render' of undefined
at normalizeComponent (componentNormalizer.js?2877:24)
at eval (Test.vue?2500:8)
at Module../src/components/Test.vue (app.js:3768)
at webpack_require (app.js:722)
at fn (app.js:99)
at eval (index.ts:6)
at Module../src/router/index.ts (app.js:3816)
at webpack_require (app.js:722)
at fn (app.js:99)
at eval (main.ts:6)
when using the ts code inside the vue file it works as expected, but i want to have a split vue and ts file
The text was updated successfully, but these errors were encountered: