<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have searched the <a href="https://github.com/zeit/next.js/issues">issues</a> of this repository and believe that this is not a duplicate.</li>
</ul>
<p dir="auto">I'm building a wrapper module around next.js and was looking for an easy way to call <code class="notranslate">build</code> and <code class="notranslate">export</code> where I can pass the config in much the same was as the server api can be initiated.</p>
<p dir="auto">Judging by nexteins implementation this is the <a href="https://github.com/elmasse/nextein/blob/master/bin/nextein">currently the way to interact with these apis</a>.</p>
<p dir="auto">it'd be great if we had either of the following:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="const nextApp = next({ dev, conf })

// server
await nextApp.prepare()

// build / export
await nextApp.build()
await nextApp.export()"><pre class="notranslate"><code class="notranslate">const nextApp = next({ dev, conf })

// server
await nextApp.prepare()

// build / export
await nextApp.build()
await nextApp.export()
</code></pre></div>
<p dir="auto">Alternatively</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="const build = require('next/server/build')
const export = require('next/server/export')

await build({ dev, conf })
..."><pre class="notranslate"><code class="notranslate">const build = require('next/server/build')
const export = require('next/server/export')

await build({ dev, conf })
...
</code></pre></div>
<p dir="auto">Thoughts?</p>
<ul dir="auto">
<li>[x ] I have searched the <a href="https://github.com/zeit/next.js/issues?q=is%3Aissue">issues</a> of this repository and believe that this is not a duplicate.</li>
</ul>
<h2 dir="auto">Expected Behavior</h2>


<p dir="auto">I am converting a React project to using Next.js. My project uses nconf and this causes irreconcilable dependency failures during page compilation.</p>
<h2 dir="auto">Current Behavior</h2>
<p dir="auto">Any component/file that imports nconf results in the following error. This error also occurs if you explicitly add the child_process and fs dependencies to the project.</p>
<blockquote>
<p dir="auto">nd:</p>
<p dir="auto">es/os-locale/index.js<br>
b/nconf/common.js, ./node_modules/nconf/lib/nconf/stores/file.js and 2 others</p>
<p dir="auto">pm install --save child_process fs<br>
found: Error: Can't resolve 'child_process' in '\node_modules\os-locale'<br>
odules\webpack\lib\Compilation.js:276:40)<br>
ebpack\lib\NormalModuleFactory.js:235:20)<br>
webpack\lib\NormalModuleFactory.js:60:20)<br>
_modules\webpack\lib\NormalModuleFactory.js:127:20)<br>
de_modules\async\dist\async.js:3874:9<br>
de_modules\async\dist\async.js:473:16<br>
modules\webpack\node_modules\async\dist\async.js:1048:13)<br>
de_modules\async\dist\async.js:958:16<br>
de_modules\async\dist\async.js:3871:13<br>
(\node_modules\webpack\lib\NormalModuleFactory.js:119:22)<br>
nhanced-resolve\lib\Resolver.js:65:10)<br>
\node_modules\enhanced-resolve\lib\createInnerCallback.js:31:19)<br>
enhanced-resolve\lib\Resolver.js:158:4)<br>
ules\enhanced-resolve\lib\Resolver.js:146:3)<br>
\node_modules\enhanced-resolve\lib\createInnerCallback.js:31:19)<br>
ble\lib\Tapable.js:252:11)<br>
t find "store" in either the context or props of "Connect(MainPageThumbs)". Either wrap the root component in a , or explicitly pass "store" as a prop to "Connect(MainPageThumbs)".<br>
\invariant\invariant.js:40:15)<br>
es\react-redux\lib\components\connectAdvanced.js:134:33)<br>
les\react-dom\cjs\react-dom-server.node.development.js:2082:14)<br>
eact-dom\cjs\react-dom-server.node.development.js:2048:5)<br>
ender (\node_modules\react-dom\cjs\react-dom-server.node.development.js:2333:22)<br>
ead (\node_modules\react-dom\cjs\react-dom-server.node.development.js:2307:19)<br>
dules\react-dom\cjs\react-dom-server.node.development.js:2679:25)<br>
s\next\dist\server\render.js:277:26)<br>
(\node_modules\next\dist\server\document.js:67:25)<br>
next\dist\lib\utils.js:111:30)<br>
regenerator-runtime\runtime.js:62:40)<br>
voke] (\node_modules\regenerator-runtime\runtime.js:296:22)<br>
nymous function) [as next] (\node_modules\regenerator-runtime\runtime.js:114:21)<br>
el\runtime\helpers\asyncToGenerator.js:12:30)<br>
bel\runtime\helpers\asyncToGenerator.js:27:9)<br>
time\helpers\asyncToGenerator.js:34:7</p>
<p dir="auto">found: Error: Can't resolve 'child_process' in '\node_modules\os-locale'<br>
odules\webpack\lib\Compilation.js:276:40)<br>
ebpack\lib\NormalModuleFactory.js:235:20)<br>
webpack\lib\NormalModuleFactory.js:60:20)<br>
_modules\webpack\lib\NormalModuleFactory.js:127:20)<br>
de_modules\async\dist\async.js:3874:9<br>
de_modules\async\dist\async.js:473:16<br>
modules\webpack\node_modules\async\dist\async.js:1048:13)<br>
de_modules\async\dist\async.js:958:16<br>
de_modules\async\dist\async.js:3871:13<br>
(\node_modules\webpack\lib\NormalModuleFactory.js:119:22)<br>
nhanced-resolve\lib\Resolver.js:65:10)<br>
\node_modules\enhanced-resolve\lib\createInnerCallback.js:31:19)<br>
enhanced-resolve\lib\Resolver.js:158:4)<br>
ules\enhanced-resolve\lib\Resolver.js:146:3)<br>
\node_modules\enhanced-resolve\lib\createInnerCallback.js:31:19)<br>
ble\lib\Tapable.js:252:11)</p>
</blockquote>


<h2 dir="auto">Steps to Reproduce (for bugs)</h2>


<ol dir="auto">
<li>Add 'nconf' module to the project<br>
<code class="notranslate">yarn add nconf</code></li>
<li>Import nconf into any component<br>
<code class="notranslate">import nconf from 'nconf'</code></li>
<li>Use nconf in your code<br>
<code class="notranslate">var conf = nconf.argv().env();</code></li>
<li>Run next app<br>
<code class="notranslate">yarn dev</code></li>
</ol>
<p dir="auto">Alternatively, I have posted an example project on GitHub that can be cloned via<br>
<a href="https://github.com/caskater4/nextnconf.git">https://github.com/caskater4/nextnconf.git</a></p>
<h2 dir="auto">Context</h2>


<p dir="auto">This is a blocking issue attempting to convert an existing React app to using server-side rendering with Next.</p>
<h2 dir="auto">Your Environment</h2>

<table role="table">
<thead>
<tr>
<th>Tech</th>
<th>Version</th>
</tr>
</thead>
<tbody>
<tr>
<td>next</td>
<td>6.0.1</td>
</tr>
<tr>
<td>node</td>
<td>8.2.1</td>
</tr>
<tr>
<td>OS</td>
<td>Windows 10</td>
</tr>
<tr>
<td>browser</td>
<td>Chrome</td>
</tr>
<tr>
<td>etc</td>
<td>nconf: 0.10.0</td>
</tr>
</tbody>
</table>