-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Upgrade to src 0.18.1 #399
Conversation
This is awesome @SiAdcock - such a great write-up - thank you! I appreciate that As for storybook, that's something I would really like to add. We also now have a health ticket to review/overhaul the JS bundling / transpilation for In the meantime, deploying to |
... as for the failing build, test are failing because |
fb06a6a
to
aa8d774
Compare
I fixed the failing build and documented why it was happening in the Source FAQs. tl;dr: submodules such as |
518c672
to
82838f7
Compare
a71567e
to
a02eefd
Compare
Seen on PROD (created by @SiAdcock and merged by @twrichards 7 minutes and 30 seconds ago) Please check your changes! |
Upgrade to Source v0.18.1
It's important for all Source packages to be at the same version, to ensure compatability between foundations and the components.
Recent upgrades to components bring a variety of bug fixes, accessibility improvements, performance increases and extra polish. You can read all about them on our Releases page. It's also better to stay relatively up-to-date at pre-version 1 to make upgrading to version 1.0.0 easier.
Include Source Foundations in server bundle
I'm including
src-foundations
and its submodules in the server bundle by whitelisting them in webpack-node-externals. This is because by default the submodules are exposed as ECMAScript modules, and Node can't execute them, sodist/server.js
crashes.What else have you tried?
src-foundations
exposes CommonJS builds of the submodules, which can be accessed by appending/cjs
to the end of each import path (e.g.@guardian/src-foundations/typography/cjs
). We could manually replace all imports ofsrc-foundations/*
withsrc-foundations/*/cjs
, but this might be difficult to remember to do when you're coding. It also means the client bundle loses out on the treeshaking benefits of ES modules.Ideally we could use resolve.alias to alias
@guardian/src-foundations/typography
to@guardian/src-foundations/typography/cjs
in the server bundle. Howeverwebpack-node-externals
doesn't seem to like this (see liady/webpack-node-externals#66) and ignores attempts to alias external modules.Whitelisting foundations, and bundling this package and its submodules into the server build, seems to be the easiest way to resolve this issue for the time being.
Have you tested these changes?
Honestly, I have not. The build seems to work and
dist/server.js
runs this time. But I'm having difficulty with the setup process for this repo (it's really really long!). It would be great if someone could show me the most frictionless way to visually test changes on this repo 馃槉 Ideally we'd have Storybook or similar, so we can develop components or mockups of screens in isolation. Is this on the roadmap?Let me know if you have any questions.