Antwerp-based teacher at the Karel de Grote University of Applied Sciences and Arts. Avid programmer at the backend, frontend, and everything in between.
Location
Antwerp, Belgium
Work
Lecturer at KdG University of Applied Sciences and Arts
Sorry. I'm new to node js. But here is what I did:
I create an asp.net core MVC apps
Then, I did exactly like the instruction in the post.
I download vue and lodash using npm
Then I import vue and lodash in entry.js and run 'npm run build'
I create a page that share the same layout, _Layout.cshtml which share the same script site.entry.js
As for lodash, it worked fine. But for Vue, when I create a vue app in the other page it said Vue is not defined. But if I create a vue app in layout page and write the js code in site.js it worked.
Antwerp-based teacher at the Karel de Grote University of Applied Sciences and Arts. Avid programmer at the backend, frontend, and everything in between.
Location
Antwerp, Belgium
Work
Lecturer at KdG University of Applied Sciences and Arts
Which bundles and pages do you have? If Vue is only imported for a single bundle then it won't be available on other pages that don't use this bundle.
Sorry. I'm new to node js. But here is what I did:
As for lodash, it worked fine. But for Vue, when I create a vue app in the other page it said Vue is not defined. But if I create a vue app in layout page and write the js code in site.js it worked.
So you have site.entry.js, which is loaded from two different pages, but only on one page it throws an error?
Yes. I loaded site.entry.js in _Layout.cshtml. I create new page which render in _Layout.cshtml . This new page throws an error.