npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

webpack-blocks-ts

v2.0.1

Published

TypeScript configuration for webpack-blocks using ts-loader

Readme

Webpack blocks - TypeScript (ts-loader)

This is a ts block providing TypeScript support using ts-loader.

webpack-blocks uses awesome-typescript-loader in its built-in typescript loader. While there is nothing wrong with this feature-rich loader, there are some cases where it doesn't quite work. In particular, it does not work for vue-loader. This package provides an alternative solution that addresses this issue.

Compatibility

webpack-blocks-ts is compabitle with Webpack 4.0 and webpack-blocks 1.0. Use the older 1.0.0 version of this package if you need to work with older versions of webpack-blocks.

Project status

This project is currently looking for a maintainer. PRs are accepted, and merged without too much scrutiny.

Installation

You can install webpack-blocks-ts using npm:

npm install --save-dev webpack-blocks-ts

or yarn:

yarn add --dev webpack-blocks-ts

Status

This package is compatible with webpack-blocks 1.x, and is therefore only compatbile with webpack 2. It is based on this code, so you may use the orignal along with webpack-blocks <1.0 if you are limited to webpack 1.

This package is in very early stages of development, and not considered production ready.

Usage

Here is the basic usage:

const {createConfig, ...} = require('webpack-blocks');
const ts = require('webpack-blocks-ts');

module.exports = createConfig([
  // ...
  ts(),
  // ...
]);

Various options can be passed to the ts block. For example:

  // ...
  ts({
    silent: true,
  }),
  // ...

These are all options of the underlying ts-loader, and are documented here.

Usage with Vue.js

As mentioned in the introduction, this block was specifically created to address issues with using the default TypeScript block with Vue.js. Here is an example using webpack-blocks-vue with this package.

const {createConfig, ...} = require('webpack-blocks');
const ts = require('webpack-blocks-ts');
const vue = require('webpack-blocks-vue');

module.exports = createConfig([
  // ...
  ts({
    appendTsSuffixTo: [/\.vue$/]
  }),
  vue({
    loaders: {
      esModule: true,
      // ...
    }
  })
  // ...
]);

In .vue files, we would then use ts as script lang:

<template>
  Hello, {{ name }}
</template>

<script lang="ts">
  import Vue from 'vue';
  import Component from 'vue-class-component';

  @Component({})
  export default class Hello extends Vue {
    name = 'World'
  }
</script>

This also works if you wish to use the src attribute instead of inlining the TypeScript code. In fact, you must use lang="ts" even in this case.

<template>
  Hello, {{ name }}
</template>

<script lang="ts" src="./Hello.ts"></script>