Skip to content

Support compile to ts languages -- respect webpack config for ts files #506

@RussellSprouts

Description

@RussellSprouts

I'm trying to use a loader to augment my existing ts files with extra data, so that we can leverage the typechecking features. In the webpack config, I have something like this:

{ test: /\.ts$/, loader: 'ts!extra-data' }

The Typescript files are otherwise normal, but the extra-data loader puts in additional lines (a representation of a template for compile time validation).
The ts-loader doesn't always apply the extra-data loader, however.

If I import a file like this:

import "src/needs-extra";

Then ts-loader will apply the extra-data loader and import the file with extra data.

But if I import it like this:

import data from "src/needs-extra";

Then ts-loader will skip the extra-data loader and interpret it directly as TypeScript. I would expect that all files imported use the loaders specified in the webpack config.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions