stevesims / govuk-frederic

https://stevesims.github.io/govuk-frederic/
MIT License
3 stars 1 forks source link

packages/api-docs could possibly be reused for govuk-frederic #6

Open Loque- opened 6 years ago

Loque- commented 6 years ago

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).

This is an issue to consider.

stevesims commented 6 years ago

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