Creating target: “node” module with runtimeChunk: “single” doesn’t work

Bug report

What is the current behavior?
We have a large code base with a number of different packages. We want to make each package a separate umd module.

Some of the packages are used on both the server, using node, and in the browser.

When we attempt to webpack the packages for use in node, we are trying to make sure that there is only one webpack “runtime”, so when we build each module we are using the runtimeChunk: “single” key. That separates the runtime chunk from the main package chunk. We want to use the runtime that is webpacked with the consumer of the package/modules, so that setting seems like what we want.

We specify target: “node”, and in the consuming package we specify the modules as externals with “commonjs2 {webpacked package}.js”.The modules are found at runtime, but the exports are not available to the consumer.

If the current behavior is a bug, please provide the steps to reproduce.
See the github repository https://github.com/bd041556/webpack-runtime-single

Look at the README.md for steps to reproduce.

What is the expected behavior?

It should create a module that can be used from node consumers.

Other relevant information:
webpack version: 4.20.2
Node.js version: 8.11.3
Operating System: Windows 10
Additional tools: N/A

Author: Fantashit

1 thought on “Creating target: “node” module with runtimeChunk: “single” doesn’t work

Comments are closed.