rnicholus / web-components-loader

Webpack loader that makes it incredibly easy to import HTML-centric Web Components into your project.
https://www.npmjs.com/package/web-components-loader
MIT License
36 stars 3 forks source link

Can I use web-components-loader together with typescript? #11

Open adrian-moisa opened 7 years ago

adrian-moisa commented 7 years ago

I would like to load web components that use typescript. Can I use web-components-loader loader in this scenario? Currently I have the following setup:

webpack

module: {

    loaders: [{
            test: /\.ts?$/,
            loader: "awesome-typescript-loader",
            include: PUBLIC_DIR,
            exclude: /node_modules/
        },
        {
            test: /\.css$/,
            exclude: /node_modules/,
            loader: "style-loader!css-loader!autoprefixer-loader"
        },
        {
            test: /\.scss$/,
            loader: 'style-loader!css-loader!sass-loader'
        },
    ]

},

app.ts

/**
 * App
 */
export class App extends HTMLElement {

    constructor() {
        super();
    }

    connectedCallback() {
        this.innerHTML = this.template;
    }

    get template() {
        return `
        <div>This is a div</div>
        `;
    }
}
window.customElements.define('vs-app', App);