baggage-loader icon indicating copy to clipboard operation
baggage-loader copied to clipboard

Not working with Typescript?

Open Anahkiasen opened this issue 8 years ago • 3 comments

Maybe I'm doing something wrong but I can't seem to make this work with Typescript. I've configured everything as per various examples:

preLoaders: [
    {
        test  : /\.ts$/,
        loader: 'baggage?[file].html&[file].css'
    }
],
loaders   : [
    {
        test   : /\.ts$/,
        loaders: [
            'awesome-typescript-loader?module=common'
        ],
    }
],

My file structure seems correct:

- SongsTable.ts
- SongsTable.html

If I go into baggage's code and log baggageFile and stats.isFile() everything is correct – the file path is correct, it exists, the inject variable even holds the correct output. But in my final bundle the baggage inject is nowhere to be found. Am I doing something wrong or?

Anahkiasen avatar Jul 21 '15 21:07 Anahkiasen

do you have any example repo so I can try to reproduce it myself?

deepsweet avatar Jul 24 '15 14:07 deepsweet

It works for me with TypeScript (similar configuration to above - baggage is set as a preLoader).

P.S. It's useful to f.e. set in your definitions file like global.d.ts a global var, by f.e. declare var template: string;. This will avoid showing errors in f.e. your component files that the template variable is missing.

jtomaszewski avatar Sep 13 '16 16:09 jtomaszewski

https://github.com/deepsweet/baggage-loader/issues/11

deepsweet avatar Sep 17 '16 14:09 deepsweet