[Vuejs]-Why can I not access a function through an instance of a package using import?

3👍

Reason is quite simple, If you will go to ‘vue-server-renderer’ you will get {createBundleRenderer} as an export member.

If you want to use like

import vueServerRenderer from 'vue-server-renderer'
const createRenderer = (serverBundle) =>
    vueServerRenderer.createBundleRenderer(serverBundle, {
        runInNewContext: false,
        template: fs.readFileSync(path.resolve(__dirname, indexFolder,'index.html'), 'utf-8')
    });

Some mistake is there related to import, you should import like
import * as vueServerRenderer from 'vue-server-renderer'
It should surely work for you

Leave a comment