chore: default exports

This commit is contained in:
calebboyd
2017-04-12 09:03:06 -05:00
parent 0d67b1dd4c
commit ac4ca3fe56
19 changed files with 140 additions and 110 deletions
+10 -12
View File
@@ -3,21 +3,19 @@ import webpack from 'webpack'
import { fromCallback } from 'bluebird'
import { resolve, join, relative } from 'path'
const
isObject = (x) => typeof x === 'object',
isString = (x) => typeof x === 'string'
const isObject = (x) => typeof x === 'object'
const isString = (x) => typeof x === 'string'
export async function bundle (compiler, next) {
export default async function bundle (compiler, next) {
let bundleConfig = compiler.options.bundle
if (!bundleConfig) {
return next()
}
const
input = compiler.options.input || require.resolve(process.cwd()),
fs = new Mfs(),
path = resolve('nexe'),
filename = 'virtual-bundle.js'
const input = compiler.options.input || require.resolve(process.cwd())
const mfs = new Mfs()
const path = resolve('nexe')
const filename = 'virtual-bundle.js'
if (isString(bundleConfig)) {
bundleConfig === require(relative(process.cwd(), bundleConfig))
@@ -30,15 +28,15 @@ export async function bundle (compiler, next) {
}
const bundler = webpack(bundleConfig)
bundler.outputFileSystem = fs
bundler.outputFileSystem = mfs
const stats = await fromCallback(cb => bundler.run(cb))
if (stats.hasErrors()) {
compiler.log.error(stats.toString())
return null
}
//eslint-disable-next-line no-sync
compiler.input = fs.readFileSync(
compiler.input = mfs.readFileSync(
join(bundleConfig.output.path, bundleConfig.output.filename)
)