Presently, I am exploring the ts-ko demo provided by TypeScript. When I directly reference Ko like this:
/// <reference path="./node_modules/@types/knockout/index.d.ts" />
No errors occur. However, if I add a reference in this manner:
import * as ko from "knockout";
An error is generated:
Uncaught ReferenceError: require is not defined
The Typescript demo mentions that:
We’ll need to grab Knockout itself, as well as something called RequireJS.
What is the correct way to define RequireJs? And why is it necessary to use requirejs for the "import" scenario?
Here is a snippet from package.json:
"dependencies": {
"jquery": "3.1.1",
"@types/jquery": "2.0.33",
"knockout": "3.4.0",
"@types/knockout": "1.1.5"
}