I created a TypeScript 2.3 app called app.ts that requires the Vue.js library version 2. I manually added the Vue.js script src in the HTML file. All I wanted was to use Vue.js with type checking. I thought I could simply reference it like this:
/// < reference path="vue.d.ts" />
However, the Vue class was not accessible from app.ts. I attempted to import the module directly:
import * as Vue from "./vue";
This time, I had to use new Vue.Vue({}) to access the class but VS 2017 build. The app.js generated started with var Vue = require("./vue");. Unfortunately, when I viewed it in the browser, I encountered some errors:
- exports reference (resolved by adding export = 0; at line 1 in .ts
- require is not a function
To address the require(), I included < script src="Scripts/require.js">< /script> but then encountered a new error: has not been loaded yet for context.
Upon trying system.js instead of require.js, I added < script>System.import('scripts/app.js');< /script> which resulted in a 404 error when trying to access "Scripts/vue" (the require from the app.js), causing the rest of the app.js to not execute.
It's important to note that I am not using tsconfig.json.
I'm surprised because in my memory, the reference of jQuery worked with TypeScript 0.9.
I'm completely bewildered. Can someone please assist me? Thank you, community!