Skip to content

Unable to use multiple ts config files #1096

@SebastianStehle

Description

@SebastianStehle

Expected Behaviour

I would like to have two different ts config files.

Actual Behaviour

I have a project with two somehow separate folders:

  • The APP using React
  • The SDK using Preact

I should probably create distinct repositories, but I thought that it makes my life easier for now, because the APP will be my first POC for the SDK. The SDK shows only little bit of HTML and uses Preact because of the small size, but I cannot get them to work in one webpack config.

I have two different entry points and tried to use two rules. But my understanding from the Readme is that it should not be needed:

config.entry = {
            'app': './src/app/index.tsx',
            'sdk': './src/sdk/index.tsx',
        };
    config.module.rules.push({
        test: /\.ts[x]?$/,
        use: [{
            loader: 'ts-loader',
            options: {
                context: root('src', 'app'),
                configFile: root('src', 'app', 'tsconfig.json')
            }
        }],
        include: root('src', 'app')
    });

    config.module.rules.push({
        test: /\.ts[x]?$/,
        use: [{
            loader: 'ts-loader',
            options: {
                context: root('src', 'sdk'),
                configFile: root('src', 'sdk', 'tsconfig.json')
            }
        }],
        include: root('src', 'sdk')
    });

Steps to Reproduce the Problem

I have created a minimum repository to reproduce the problem. It contains a little bit of extra packages which I have no removed.

https://github.com/SebastianStehle/tsloader-test

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