PolymerX / lit-loader

LitElement Single File Component loader for Webpack.
MIT License
94 stars 8 forks source link

TypeScript support #36

Open gallafent opened 5 years ago

gallafent commented 5 years ago

First, really pleased to see this, and I'd like to move at least part of our project to use single-file components as we go forward ... but we use TypeScript, and as I understand it (and from a brief skim of the sources) only JavaScript is supported inside the <script> element.

It would be excellent to see support for TypeScript in the <script> element of the .lit single file :)

LasaleFamine commented 5 years ago

Hi @gallafent, thank you for trying the lit-loader.

Actually I think this could be easy to achieve: instead of using, for example, the babel-loader, as stated in the Readme, you can use something like ts-loader and using it like:


module: {
    rules: [
      {
        test: /\.lit$/,
        use: ['ts-loader', 'lit-loader']
      }
    ]
  }

This should work, since the lit-loader is extracting the js inside the <script> tag and pass it to ts-loader.

Let me know if it will work.

gallafent commented 5 years ago

Aha, of course! ... I will try it and report back!