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 🙏

© 2026 – Pkg Stats / Ryan Hefner

gt-pack

v1.2.9

Published

啊就一個 webpack 的通用使用整合包

Readme

GT Pack

簡介

啊就一個 webpack 的通用使用整合包。

使用 Webpack 2.x,理論上可相容 3.x 版本。

安裝

npm install gt-pack

使用

webpack.config.js 加入:

const gtPack = require('gt-pack');

分別設定範例

JS

module.exports = new gtPack.js({
    entry: {
        index: '__dirname + ' / js / index.js ',
    },
    output: {
        filename: 'public/js/[name].js',
        path: __dirname + '/',
    }
});

TS

module.exports = new gtPack.ts({
    entry: {
        index: '__dirname + ' / js / index.ts ',
    },
    output: {
        filename: 'public/js/[name].js',
        path: __dirname + '/',
    }
});

在專案根目錄新增:tsconfig.webpack.json

{
    "compilerOptions": {
        "removeComments": true,
        "sourceMap": true
    }
}

// 可以自由增加自己的設定

CSS

module.exports = new gtPack.css({
    entry: {
        index: '__dirname + ' / less / index.less '
    },
    output: {
        filename: 'public/style/[name].css',
        path: __dirname + '/',
    }
}, {
    filename: 'public/style/[name].css',
});

JS + CSS

// JS
let js = new gtPack.js({
    entry: {
        index: __dirname + '/js/index.js',
    },
    output: {
        filename: 'public/js/[name].js',
        path: __dirname,
    }
});

// CSS
let css = new gtPack.css({
    entry: {
        index: __dirname + '/less/index.less'
    },
    output: {
        filename: 'public/style/[name].css',
        path: __dirname,
    }
}, {
    filename: 'public/style/[name].css',
});

module.exports = [js, css];

整合設定

第一種設定方式

let x = gtPack.GuanTing({
    dirName: __dirname + '/views/output', // 輸出位置
    html: {
        index: __dirname + '/dev/index.ejs',
        register: __dirname + '/dev/register.ejs'
    },
    css: {
        index: __dirname + '/dev/css/index.less',
        register: __dirname + '/dev/css/register.less',
    },
    js: {
        index: __dirname + '/dev/js/index.js',
        register: __dirname + '/dev/js/register.js',
    }
});

module.exports = x;

第二種設定方式

let x = gtPack.GuanTing({
    dirName: __dirname + '/views/output', // 輸出位置
    html: gtPack.readEntries(__dirname + '/views/', process.cwd() + '/build/views/'),
    css: gtPack.readEntries(__dirname + '/views/less/', process.cwd() + '/build/views/', 'less')
    js: gtPack.readEntries(__dirname + '/views/js/', process.cwd() + '/build/views/', 'js')
});

module.exports = x;

樹狀結構

這是一個樹狀節點版本的結構,讓webpack可以在不同的資料夾中有不同的設定。

let noder = require('gt-pack').noder;
let List = [
    require('./dirA/webpack.config.js'),    // 其他設定
    require('./dirB/webpack.config.js'),    // 其他設定
];

module.exports = noder(List);