Skip to content

Instantly share code, notes, and snippets.

@jstrimpel
jstrimpel / how.md
Last active March 16, 2018 19:27
Is it possible to have separate build processes that generate bundles that define dependencies, which can be used by an application without having to expose globals and rely on aliases?

Is it possible to have separate build processes that generate bundles that define dependencies, which can be used by an application without having to expose globals and rely on aliases?

Requirement

There are two separate build processes:

  • Core: This builds a distribution of common core dependencies
  • Component: This externalizes anything in core build

Use Case

The following two files are entry points for two different build processes. The component entry webpack config defines core as an external.

I have two modules A and B. A declares B as a dependency. B is built into a bundle and B's bundle is used as an entry for a DllPlugin bundle. A's build uses the manifest generated by B in a DllReferencePlugin config. I cannot get A's build to externalize and reference B's DLL. Below are the plugin configurations.

A

new webpack.DllReferencePlugin({
  context: 'ABSOLUTE_PATH_TO_B',
  manifest: require('ABSOLUTE_PATH_TO_B/dist/index-manifest')
})
@jstrimpel
jstrimpel / .a_use_case.md
Last active December 28, 2015 20:32
babel analytics, performance plugins
  • Capture analytics from synthetic events and gather performance metrics
  • Transform React components
@jstrimpel
jstrimpel / code.js
Last active September 8, 2015 19:45
code sample pattern
// this outlines the recommended approach for handling code samples in the book
// block 1 introdcues a stubbed module
// block 2 contains implementation details for subbed module method
// this prevents duplication while still providing context
// comments before code block would be the code block tile in the book
// [[app_stub_2_4]]
// Application Stub
export default class Application {
@jstrimpel
jstrimpel / index.js
Created July 11, 2015 20:22
hapi hello world
var Hapi = require('hapi');
// Create a server with a host and port
var server = new Hapi.Server();
server.connection({
host: 'localhost',
port: 8000
});
// Add the route

addChild(container, component, options)

Add a child component to a parent's container.

Arguments

  1. container (String): Component container to which the child will be added.
  2. component (String): Component to be added.
  3. options (Object):
    • success (Function): Success callback.
    • error (Function): Error callback.
    • index (Number): Insert index for the container. The default is 0.
@jstrimpel
jstrimpel / config.js
Last active August 29, 2015 14:19
react custom attribute support
React.config({
HTMLDOMPropertyConfig: {
isCustomAttribute: RegExp.prototype.test.bind(/^(data|aria|lazo)-[a-z_][a-z\d_.\-]*$/),
Properties: {
'some-other-prop': null
}
});
// would trigger ReactInjection.DOMProperty.injectDOMPropertyConfig(HTMLDOMPropertyConfig);
@jstrimpel
jstrimpel / server.js
Created April 12, 2015 23:48
set up hapi error listener
define(['lazoServer'], function (LazoServer) {
'use strict';
return LazoServer.extend({
// register good with lazo server pack
// hapi - a reference to the hapi module itself
// pack - the lazo server pack
// servers - the servers that belong to the lazo pack
// options.success and options.error
@jstrimpel
jstrimpel / eventing-api.md
Last active August 29, 2015 14:18
Lazo Widget Enhancements Design

Widget instances should have an event aggregator.

Triggering Events

Signature is eventName and data.

Listening for Events

Signature is eventName and callback that receives data from event trigger.

@jstrimpel
jstrimpel / a.js
Last active August 29, 2015 14:18
get module path and/or module id for module that called the plugin load
define(['loader!request'], function (someModule) {
});