jbrantly/ts-jsx-loader

Not working on multiple files

dignifiedquire opened this issue · 4 comments

Hey,

thanks for the module, it is great, but I can't get it to work on multiple files. I use the config as described in the readme, combined with the ts-loader. But it only executes the jsx-loader on the first file and not on subsequently required files, e.g. if my entry point is main.ts and I have

import routes = require('./routes');

it does not convert the jsx insides routes.ts.

Any ideas or pointers would be great.

Hmm. This works for me. It may help if I saw your config file. It sounds like for whatever reason the routes.ts file isn't going through the loader chain (possibly a bad regex, or maybe if you have routes.js that is getting picked up instead).

So it seems it's not an issue with ts-jsx-loader, but rather with ts-loader. When I switched to typescript-loader, the issue went away.

This is the relevant excerpt from config:

    entry: 'app/scripts/main.ts',
    resolve: {
        extensions: ['', '.webpack.js', '.web.js', '.js', '.ts']
    },
    module : {
        loaders : [
            {
                test: /\.ts?$/,
                exclude: /node_modules/,
                loader: 'babel!ts-loader?noImplicitAny=true&target=ES6!ts-jsx-loader'
            }
        ]
    },

Very strange, I switched back because of other issues and now everything is working fine :) Sorry for the noise.

Haha, no problem :) Glad it's working for you now.