Issue originally opened by @taranchauhan on govuk-react, moving here as it is out of scope for the react library.
index.js in api-docs Line 15 is hardcoded to govuk-react
const components = require(‘govuk-react’);
If this was dynamic, then it would allow us to reuse it. However, dynamic variables in requires cause an issue with Webpack at build time.
Since Webpack is running in build-time, it can’t figure out which modules to bundle when the name is a dynamic variable. You can give it hints by specifying part of the path (for example, if you know all the modules are in a single directory).
We could probably tell api-docs what package we're using via an environment variable, thus allowing it to be neutral and re-usable across both projects
Issue originally opened by @taranchauhan on govuk-react, moving here as it is out of scope for the react library.
index.js in api-docs Line 15 is hardcoded to govuk-react
If this was dynamic, then it would allow us to reuse it. However, dynamic variables in requires cause an issue with Webpack at build time.
Since Webpack is running in build-time, it can’t figure out which modules to bundle when the name is a dynamic variable. You can give it hints by specifying part of the path (for example, if you know all the modules are in a single directory).
This is an issue to consider.