Closed tmeasday closed 3 years ago
I wonder if it would be possible to replace the require.context code with import() as that would work with lazy compilation. If not, then we'll have to figure out a fix on webpack side with Tobias.
Sorry, yeah I haven't had a moment to try it just yet (will do later tonight or tomorrow!). I have tested that you can make a path based import()
, and it would be easy enough to create a new "import style" based on that.
@bebraw I added dynamic
and lazy-dynamic
import modes that map './path/*/.stories.js' to:
require(`./path/${X}.stories.js`);
import(`./path/${X}.stories.js`);
respectively.
Best of all I confirmed the latter works with COMPILE_LAZILY=1
, nice job.
Going to merge this, hope that's OK!
Rather than symlinking the project inside the skeleton and running with
PROJECT=x
instead:.storybook/main.js:skeletonWebpackConfig
stories.json
(cf https://github.com/tmeasday/storybook-skeleton/issues/22)See the README for more details.
Doing things this way relies on the app's FS structure and
node_modules
more, which was required to get it running in Shopify's projects.