0
votes

I have a new project and I want to code using Visual Studio, Typescript, ASP.net Core and CommonJS Module System. Actually I need a Module System to organize my dependencies. What should I do?

Can I use CommonJS Module System in a typescript Project using Visual Studio?

ts config:

{
  "compileOnSave": true,
  "compilerOptions": {
    "noImplicitAny": false,
    "noEmitOnError": true,
    "removeComments": false,
    "sourceMap": true,
    "target": "es5",
    "module": "commonjs"
  },
  "exclude": [
    "node_modules",
    "wwwroot"
  ]
}
1

1 Answers

1
votes

Yes, you can use it in a same manner that you would use it in Javascript. Typescript is superset of Javascript, all things possible in Javascript are also possible in Typescript.

Refer to this:

https://www.typescriptlang.org/docs/handbook/modules.html

And search (ctrl/cmd + f) for 'require'