webpack-for-webDll ModuleNotFoundError: Module not found: Error: Can't resolve 'child_process'

Moved from GitHub dgraph-js/12

Posted by MichelDiz:

This error has constantly appeared in my test and study application. I can use the application, but it generates errors of communication between services. Because the error causes the webpack to load in half. Here’s some information.

Should open Port 3000, but the load is not complete opening only the 8080 via ngrok which is useless. Without the dgraph-js dependencies inside the application works fine. Can you give a light here please?

webpack-for-webDll info Generating vendor_web DLL bundle with modules:
["antd","apollo-cache-inmemory","apollo-client","apollo-fetch","apollo-fetch-upload","apollo-link","apollo-link-batch-http","apollo-link-ws","apollo-logger","bootstrap","dgraph-js","error-stack-parser","filesize","fs","graphql","graphql-auth","graphql-iso-date","graphql-tag","history","immutability-helper","jwt-decode","lodash","minilog","persistgraphql","prop-types","react","react-apollo","react-cookie","react-debounce-input","react-dom","react-dropzone","react-ga","react-helmet","react-hot-loader","react-native-web","react-redux","react-router","react-router-dom","react-router-redux","react-stripe-elements","react-transition-group","reactstrap","redux","redux-devtools-extension","redux-form","sourcemapped-stacktrace","styled-components","subscriptions-transport-ws"]

webpack-for-webDll ModuleNotFoundError: Module not found: Error: Can't resolve 'child_process' in '/Volumes/test/node_modules/detect-libc/lib'
    at factoryCallback (/Volumes/test/node_modules/webpack/lib/Compilation.js:276:40)
    at factory (/Volumes/test/node_modules/webpack/lib/NormalModuleFactory.js:235:20)
    at resolver (/Volumes/test/node_modules/webpack/lib/NormalModuleFactory.js:60:20)
    at asyncLib.parallel (/Volumes/test/node_modules/webpack/lib/NormalModuleFactory.js:127:20)
    at /Volumes/test/node_modules/async/dist/async.js:3874:9
    at /Volumes/test/node_modules/async/dist/async.js:473:16
    at iteratorCallback (/Volumes/HSierraDados/Dev-2018/GitLab/uapi/node_modules/async/dist/async.js:1048:13)
    at /Volumes/test/node_modules/async/dist/async.js:958:16
    at /Volumes/test/node_modules/async/dist/async.js:3871:13
    at resolvers.normal.resolve (/Volumes/test/node_modules/webpack/lib/NormalModuleFactory.js:119:22)spin error Error: Build error
    at webpackReporter (/Volumes/test/node_modules/spinjs/src/executor.ts:96:11)
    at reporter (/Volumes/test/node_modules/spinjs/src/executor.ts:655:50)
    at onCompiled (/Volumes/test/node_modules/webpack/lib/Compiler.js:230:19)
    at applyPluginsParallel.err (/Volumes/test/node_modules/webpack/lib/Compiler.js:500:20)
    at /Volumes/test/node_modules/tapable/lib/Tapable.js:285:11
    at _addModuleChain (/Volumes/test/node_modules/webpack/lib/Compilation.js:498:12)
    at processModuleDependencies.err (/Volumes/test/node_modules/webpack/lib/Compilation.js:474:15)
    at finalCallbackAddModuleDependencies (/Volumes/test/node_modules/webpack/lib/Compilation.js:375:12)
    at /Volumes/test/node_modules/async/dist/async.js:473:16
    at iteratorCallback (/Volumes/test/node_modules/async/dist/async.js:1048:13)
webpack-for-server Starting backend
webpack-for-server Time: 26610ms
webpack-for-server Spawning node --inspect=9229 /Volumes/test/build/server/index.js
Debugger listening on ws://127.0.0.1:9229/63cf2171-8277-44509-a88a-10bb3dd4f8ee41
For help see https://nodejs.org/en/docs/inspector
backend info API is now running on port 8080

gpahal commented :

Can you share your webpack config if it is not private?

MichelDiz commented :

it’s from this kit GitHub - sysgears/apollo-universal-starter-kit: Apollo Universal Starter Kit is an SEO-friendly, fully-configured, modular starter application that helps developers to streamline web, server, and mobile development with cutting-edge technologies and ultimate code reuse.

Go to “Tools” Folder. |> webpackAppConfig.js

Check |> webpack.config.lint.js (In root)

PS. In Production mode it is working, however every change I make I have to generate a new Build. This slows down.

And we use this spinjs - npm | GitHub - sysgears/spinjs: SpinJS is now Zen! The project has been renamed and moved to Larix Framework.

MichelDiz commented :

I got the solution with the kit maintainers. It was just adding dgraph-js as part of the server dependencies. In webpackAppConfig.js. It was not a Dgraph-js problem anyway. Sorry opened this issue without clarify it first.

Solution:

const dependencyPlatforms = {
  'dgraph-js': 'server',
(...)