Skip to content

Importing modules with require doesn't work with plugins #190

Open
@ghost

Description

Using custom requirejs plugins is not supported. This results in an error, even if the './MyModule' path is valid:

import MyModule = require('someplugin!./MyModule');

Obviously tsc can't know what the plugin does so one may argue reporting an error is the right thing to do, however some plugins preprocess (or load using alternative methods) resources matching the local file system hierarchy (in my case I use a plugin which uses an alternative way to load code).

Unless there are better ideas I suggest to skip the plugin prefix (someplugin!) and validate the local path, as usual. If there was a compiler flag (either a command line option or a source-code-level magic statement) controlling this behaviour that would surely make everyone happy.

For completeness: requiring in the class body is not a solution as such statements don't validate the path.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions