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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@wfh/webpack2-builder

v1.1.10-0

Published

Deprecated ! Browser side stuff builder module based on Webpack2

Downloads

3

Readme

The core build component based on Webpack 2

Unlike normal Webpack projects

  • less-loader '@import ~` is hijacked by lib/npmimport-css-loader.js which works with require-injector

  • Webpack advanced mechanism to resolve files, aka webpack.config.js's resolve.alias is not recommended, should use require-injector instead, by set browser-inject.js.

  • Setting package.json property "style" is just like calling require('xxx.css') from an package's main JS file.

entry-html-loader

It marks all DR component entry pages in compiler._lego_entry[pagePath] which later on will be read by multi-entry-html-plugin

manual-chunk-plugin

Used instead of CommonsChunkPlugin which doesn't support real muti-entry chunk project.

CommonsChunkPlugin works good in case like having one entry chunk and couple of common library Js chunk.

multi-entry-html-plugin

Used instead of HtmlWebpackPlugin, supports inserting <script> and <link> for multiple HTML file of multiple entry chunk. Also it inlines manifest chunk in entry HTML file.

api-loader

Resolves require('__api') and __api expression statement, also works with require-injector.

CSS scope

If the JS file is a "main" file of a component package, it will be inserted with code:

document.getElementsByTagName('html')[0].className += ' <package short name>';

@dr-core/webpack2-builder/lib/html-loader

Replaces assets://<component>/... in *[src|href] from all html files.

@dr/template-builder

Compiles all HTML resource as they are Swig-template file. For details about how to defined Swig template local variables and other advanced setting, please read readme of @dr/template-builder.

TODO: add according Webpack module.fileDependency for Swig tag {% include "<file>" %}

Component configuration

Each component should be configable, so that we can deal with differenct environment like demo, production... For example, your web app probably wants to connect with different ajax API for different environment or to be more flexable and reusable

TODO

How to extend Webpack config file

In your main JS file of component

require('@dr-core/webpack2-builder').tapable.plugin('webpackConfig', function(webpackConfig, cb) {
	// do something to webpackConfig
	cb(null, webpackConfig);
	// or encounter errors
	// cb(error);
});

Using Typescript

import api from '__api';
import {WebpackConfig, WebpackConfigFunc, Webpack2BuilderApi} from '@dr-core/webpack2-builder/main';
(api as Webpack2BuilderApi).configWebpackLater(
	function(webpackConfig: WebpackConfig): WebpackConfig {
			// TODO: change webpackConfig
			return webpackConfig;
		});