1
1
mirror of https://github.com/jxnblk/mdx-deck.git synced 2024-11-25 15:50:39 +03:00
This commit is contained in:
Brent Jackson 2019-06-19 14:23:39 -04:00
commit 81ad54f05c

View File

@ -2,6 +2,7 @@ const path = require('path')
const puppeteer = require('puppeteer') const puppeteer = require('puppeteer')
const mkdirp = require('mkdirp') const mkdirp = require('mkdirp')
const dev = require('mdx-deck/lib/dev') const dev = require('mdx-deck/lib/dev')
const findup = require('find-up')
module.exports = async opts => { module.exports = async opts => {
const { type, outDir, outFile, port, width, height, sandbox } = opts const { type, outDir, outFile, port, width, height, sandbox } = opts
@ -11,6 +12,13 @@ module.exports = async opts => {
args.push('--no-sandbox', '--disable-setuid-sandbox') args.push('--no-sandbox', '--disable-setuid-sandbox')
} }
if (opts.webpack) {
opts.webpack = require(path.resolve(opts.webpack))
} else {
const webpackConfig = findup.sync('webpack.config.js', { cwd: opts.dirname })
if (webpackConfig) opts.webpack = require(webpackConfig)
}
const server = await dev(opts) const server = await dev(opts)
const browser = await puppeteer.launch({ args }) const browser = await puppeteer.launch({ args })