Skip to content

The output of getCustomTransformers makes compiling fail when tsconfig.json contains rootDir. #597

@zheeeng

Description

@zheeeng

versions:

"typescript": "~2.4.0",
"ts-loader": "^2.2.1",

The test code:

// webpack.config.js
// path: module.rules

      {
        test: /\.(ts|tsx)$/,
        include: paths.appSrc,
        loader: require.resolve('ts-loader'),
        options: {
          transpileOnly: true,
          getCustomTransformers: () => ({
            before: [ content => node => node ] // Issue caused by here!!!!!!!!!!
          }),
        },
      }

complier print:

error TS6059: File 'index.tsx' is not under 'rootDir' '/Users/Zheeeng/Workspace/project/src'. 'rootDir' is expected to contain all source files.

The tsconfig.json:

"compilerOptions": {
    "rootDir": "src"
}

Does the getCustomTransformers saved the temp content to other place and fails the compiling?

I encountered this issue while I'm using ts-import-plugin, and reported it at ts-plugin/ts-import-plugin#5. After a simple test, I find it's something wrong with ts-loader.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions