3

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"
  ]
}

2 Answers 2

2

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'

Sign up to request clarification or add additional context in comments.

Comments

0

Yes you can, but in new projects. TS use ES Module System.

1 Comment

Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.