mirror of
https://github.com/terribleplan/next.js.git
synced 2024-01-19 02:48:18 +00:00
Add the ability to pass next configuration to production builds (#2345)
This commit is contained in:
parent
3a9c419160
commit
d2149da54d
|
@ -7,9 +7,9 @@ import webpack from './webpack'
|
||||||
import replaceCurrentBuild from './replace'
|
import replaceCurrentBuild from './replace'
|
||||||
import md5File from 'md5-file/promise'
|
import md5File from 'md5-file/promise'
|
||||||
|
|
||||||
export default async function build (dir) {
|
export default async function build (dir, conf = null) {
|
||||||
const buildDir = join(tmpdir(), uuid.v4())
|
const buildDir = join(tmpdir(), uuid.v4())
|
||||||
const compiler = await webpack(dir, { buildDir })
|
const compiler = await webpack(dir, { buildDir, conf })
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await runCompiler(compiler)
|
await runCompiler(compiler)
|
||||||
|
|
|
@ -27,9 +27,9 @@ const interpolateNames = new Map(defaultPages.map((p) => {
|
||||||
|
|
||||||
const relativeResolve = rootModuleRelativePath(require)
|
const relativeResolve = rootModuleRelativePath(require)
|
||||||
|
|
||||||
export default async function createCompiler (dir, { dev = false, quiet = false, buildDir } = {}) {
|
export default async function createCompiler (dir, { dev = false, quiet = false, buildDir, conf = null } = {}) {
|
||||||
dir = resolve(dir)
|
dir = resolve(dir)
|
||||||
const config = getConfig(dir)
|
const config = getConfig(dir, conf)
|
||||||
const defaultEntries = dev ? [
|
const defaultEntries = dev ? [
|
||||||
join(__dirname, '..', '..', 'client', 'webpack-hot-middleware-client'),
|
join(__dirname, '..', '..', 'client', 'webpack-hot-middleware-client'),
|
||||||
join(__dirname, '..', '..', 'client', 'on-demand-entries-client')
|
join(__dirname, '..', '..', 'client', 'on-demand-entries-client')
|
||||||
|
|
Loading…
Reference in a new issue