-
Notifications
You must be signed in to change notification settings - Fork 331
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix webpack docs example #2869
Fix webpack docs example #2869
Conversation
Unrelated to the changes, but from giving it a quick go on my machine, I've had to make a few updates for
After that, however:
Looks like there's a few more things to do to get the Webpack example back on its feet (and maybe up to date with the latest Webpack versions?) |
@romaricpascal Thanks for digging into this. I'll make it a draft as I only really fixed paths and named imports @36degrees Perhaps we could add tests for various bundlers? |
I've added this to the agenda to discuss at tomorrow's dev catch up. |
4f594a9
to
0349af0
Compare
@36degrees @romaricpascal I've also fixed webpack (including the CSS) ready for catch up |
343aac2
to
39c2725
Compare
loader: 'sass-loader', | ||
options: { | ||
sassOptions: { | ||
quietDeps: true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Silence deprecation warnings from dependencies in Dart Sass
https://frontend.design-system.service.gov.uk/importing-css-assets-and-javascript/#silence-deprecation-warnings-from-dependencies-in-dart-sass
39c2725
to
25fc0f5
Compare
@@ -7,6 +7,10 @@ | |||
"npm": "^8.5.0" | |||
}, | |||
"license": "MIT", | |||
"workspaces": [ | |||
"docs/examples/*", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line makes sure npm install
and npm ci
also install webpack's dependencies
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
quibble Is that something we absolutely need for the example running? I'd rather we only brought example dependencies when trying to run the example rather than at every install.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @romaricpascal
This was to stop the example(s) going stale or getting out of sync again.
Enables things like:
npm run dev --workspace ./docs/examples/webpack
It's possible of course, but then we'd need an extra lockfile (per example) and have to rely on file://
package paths to the parent govuk-frontend
. We'd also opt out of:
- Package updates + auditing
- Dependabot dependency updates
- Automatic package deduplication
- Postinstall
"npm ls --depth=0"
check - Example gets a symlink to
govuk-frontend
I'd recommend the same approach for:
./app/package.json
./tasks/package.json
☝️ Not yet of course, but each "area" should manage its own packages and tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense. Thanks for clarifying 😄 I like the idea of properly separating the app and tasks as well, that sounds pretty neat 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah 100%
Deployment to Heroku doesn't need all our developer/test tooling etc 😊
@@ -7,6 +7,10 @@ | |||
"npm": "^8.5.0" | |||
}, | |||
"license": "MIT", | |||
"workspaces": [ | |||
"docs/examples/*", | |||
"package" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whilst ./package/package.json doesn't have any dependencies, it also creates a symbolic link from ./node_modules/govuk-frontend
→ ./package
This makes sure webpack's example can "find" the local govuk-frontend
import { Button } from 'govuk-frontend'
deefa44
to
d5ed72c
Compare
d5ed72c
to
ae47856
Compare
ae47856
to
f170dd1
Compare
78bd8ad
to
702b6e5
Compare
f170dd1
to
87e2c9e
Compare
702b6e5
to
a4061af
Compare
87e2c9e
to
ab0d575
Compare
ab0d575
to
5e3a6de
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The demo is working 🎉 Thanks for putting it back on its feet 🙌🏻
Only little quibble is with the installation for the examples dependency with the project's npm install
(unless I misunderstood what it did), which I'd prefer to bring only when running the examples. It's not blocking for me if there's no other easy way 😄
@@ -7,6 +7,10 @@ | |||
"npm": "^8.5.0" | |||
}, | |||
"license": "MIT", | |||
"workspaces": [ | |||
"docs/examples/*", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
quibble Is that something we absolutely need for the example running? I'd rather we only brought example dependencies when trying to run the example rather than at every install.
Thanks @romaricpascal I'll link up to the reply (to your concern) as it's useful #2869 (comment) |
Splitting out the "Fix webpack docs" commit from #2863 into this one
I've made these changes by hand so needs a bit of scrutiny