Skip to content

Instantly share code, notes, and snippets.

View TheLarkInn's full-sized avatar
🦀
Getting Rusty

Sean Larkin TheLarkInn

🦀
Getting Rusty
View GitHub Profile
@TheLarkInn
TheLarkInn / gource.bash
Last active January 20, 2021 20:16 — forked from blake-newman/gource.bash
Create a gource.io of multiple repos
#!/bin/bash
ARRAY=(
"webpack:webpack"
"webpack:example-app"
"webpack:enhanced-require"
"webpack:webpack-dev-middleware"
"webpack:enhanced-resolve"
"webpack:template"
"webpack:webpack-dev-server"
@TheLarkInn
TheLarkInn / Readme.md
Created August 27, 2017 15:27 — forked from monkindey/Readme.md
webpack tapable with log

How

Why

It will be clear to understand the flow of webpack.

@TheLarkInn
TheLarkInn / _entry.js
Last active July 14, 2017 22:09
Example of using webpack and .wat as a module type
import("./abc.js").then(abc => abc.doIt());
@TheLarkInn
TheLarkInn / _entry.js
Last active July 14, 2017 22:10
An example of how you could use C++ in JS with cpp-loader, and webpack's first class WASM support.
import("./abc.js").then(abc => abc.doIt());
import(/* webpackChunkName: "my-chunk-name" */ 'module');
@TheLarkInn
TheLarkInn / gist:5602da70d184340f7648566c6eb3a054
Created April 5, 2017 05:31
Notes on functional webpack plugin creation
const createClass = () => {
return class {
constructor(options) { this.options = options || {}; }
};
}
const Plugin = (x) => (
return {
map: f => Plugin(f(x)),
const MODULE_DIR = /(.*([\/\\]node_modules|\.\.)[\/\\](@[^\/\\]+[\/\\])?[^\/\\]+)([\/\\].*)?$/g;
{
loader: 'babel-loader',
test: /\.jsx?$/,
include(filepath) {
if (filepath.split(/[/\\]/).indexOf('node_modules')===-1) return true;
let pkg, manifest = path.resolve(filepath.replace(MODULE_DIR, '$1'), 'package.json');
try { pkg = JSON.parse(fs.readFileSync(manifest)); } catch (e) {}
return !!(pkg.modules || pkg['jsnext:main']);
@TheLarkInn
TheLarkInn / webpack2-loaders.js
Created September 26, 2016 15:42
Example of mixing query params between multiple loaders (which wasn't possible at one time) with webpack 2.
module.exports = config;
const config = {
module: {
rules: [ //<=== 'loaders' works as a fallback but for .23+ best to start using "rules" instead.
{
test: /\.less/,
loaders: [
"style-loader",
{loader: "css-loader", query: {}},
@TheLarkInn
TheLarkInn / explanation.md
Last active June 7, 2018 13:33
Understanding some CommonsChunksPlugin teqniques

When you use the names property in the CommonsChunkPlugin({}) and pass an array as the value, webpack converts what is seen below:

      new webpack.optimize.CommonsChunkPlugin({
        names: ['app', 'vendor', 'manifest'],  // creating manifest.js 
        minChunks: Infinity
      })

Into:

@TheLarkInn
TheLarkInn / README.md
Created June 3, 2016 15:24
Angular2 + Typescript Demo Plunk

Angular2 Starter Plunker - Typescript - RC.0

A simple plunker demonstrating Angular2 usage:

  • Uses SystemJS + TypeScript to compile on the fly
  • Includes binding, directives, http, pipes, and DI usage.