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 / stats.json
Created September 26, 2017 23:07
Sample webpack stats.json
This file has been truncated, but you can view the full file.
{
"errors": [],
"warnings": [],
"version": "3.6.0",
"hash": "87cd04b20883a998cc03",
"time": 283,
"publicPath": "",
"assetsByChunkName": {
"main": "main.chunk.js"
},
@TheLarkInn
TheLarkInn / stats.json
Created September 26, 2017 23:07
Sample webpack stats.json
This file has been truncated, but you can view the full file.
{
"errors": [],
"warnings": [],
"version": "3.6.0",
"hash": "87cd04b20883a998cc03",
"time": 283,
"publicPath": "",
"assetsByChunkName": {
"main": "main.chunk.js"
},
@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: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());
@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());
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 / outside_event.plugin.ts
Created April 22, 2016 20:24
EventManagerPlugin extension to add to EVENT_MANAGER_PLUGINS for Angular2. Lets you handle clicking outside of target element.
import {DomEventsPlugin} from 'angular2/platform/common_dom';
// Have to pull DOM from src because platform/common_dom returns DOM as null.
// I believe its a TS bug.
import {DOM} from 'angular2/src/platform/dom/dom_adapter';
import {Injectable} from 'angular2/core';
import {noop} from 'angular2/src/facade/lang';
@Injectable()
export class DOMOutsideEventPlugin extends DomEventsPlugin {
eventMap: Object = {
@TheLarkInn
TheLarkInn / bootStrapItNow.ts
Last active November 30, 2016 16:00
How to bundle up custom plugins with EVENT_MANAGER_PLGUINS
import {bootstrap} from 'angular2/platform/browser';
import {DIRECTIVES, PIPES, PROVIDERS, ENV_PROVIDERS, PLUGINS} from './platform/browser';
import {App, APP_PROVIDERS} from './app';
bootstrap(App, [
...PROVIDERS,
...ENV_PROVIDERS,
...DIRECTIVES,
...PIPES,
...APP_PROVIDERS,