Friday, 28 April 2017

Trying to use vue with ts-node

I came to a point where I would gladly import a .vue file in my server-side code. Deeply, I don't really use the *.vue file exports yet but some code is common for client-side and server-side and refer these files.

I am using ts-node now for dev/debug and I use webpack to bundle my client-code with my *.vue files.

I tried many solutions but found none really working - even the .d.ts refered in tsConfig.json

declare module '*.vue' {
    import Vue = require('vue')
    const value: Vue.ComponentOptions<Vue>
    export default value
}

Does anyone know an elegant solution or should I just resign to use webpack for the server-side also? (I have hesitations as the compilation is already quite slow with the client-side compilation only)



via eddow

No comments:

Post a Comment