Skip to content

Instantly share code, notes, and snippets.

View mark-bradshaw's full-sized avatar

Mark Bradshaw mark-bradshaw

View GitHub Profile
@mark-bradshaw
mark-bradshaw / requireThroughWebpack.js
Created October 8, 2015 17:02
Use an in-memory webpack compiler to get specific files or file trees.
import _ from 'lodash';
import MemoryFileSystem from 'memory-fs';
import webpack from 'webpack';
import webpackConfig from '../../webpack.config';
// This function allows you to do an on-the-fly, in-memory webpack compile starting
// with whatever file entry point you want, and receive back the compiled object.
export default (entry, callback) => {