Why Can I Not Access A Function Through An Instance Of A Package Using Import?
I am trying to use ES6 imports and am running into a problem with vue-server-renderer. It is similar to this question but not quite the same. I get an error saying TypeError: Canno
Solution 1:
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'constcreateRenderer = (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
Post a Comment for "Why Can I Not Access A Function Through An Instance Of A Package Using Import?"