PolymerX / lit-loader

LitElement Single File Component loader for Webpack.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TypeScript support

gallafent opened this issue · comments

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 :)

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.

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