web-components-loader icon indicating copy to clipboard operation
web-components-loader copied to clipboard

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

Open adrian-moisa opened this issue 7 years ago • 0 comments

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

adrian-moisa avatar Sep 28 '17 21:09 adrian-moisa