Skip to content

Can we please have module resolution for AMD? #9153

Closed
@blendsdk

Description

@blendsdk

Hi,

I would know what are the possibilities and reservations for having a sort of module resolution
when compiling a project with --module=amd

The context:

  • This is about NodeJS and NPM modules
  • I am developing a fairly large library that is distributed as an NPM module
  • The project ultimately compiles down to a single js file and a single d.ts file.
  • The framework consist of many classes, one class per file, and the classes are organized in various namspaces (like we do it in .NET)
  • At the consumer side, after installing the lib with npm install --save I use typings install --save --global file:node_modules/path/to/lib.d.ts

The problem and the request

  • I use statements like var fs = require('fs'); at the top of some classes. This works at runtime just fine but at develop time, I don't get "intellisense" from VSCode for example, even with adding /// ref and installing dt~node with typings . The compiler sees 'fs' as 'any' because require("fs") is not resolved to an external module.

I understand that is about module resolution and emitting somekind of require statement, but would it be possible to implement such module resolution (just for the sake of intellisense) in the compiler.

Any thoughts?

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    QuestionAn issue which isn't directly actionable in code

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions