Skip to content

Conversation

web-padawan
Copy link
Member

@web-padawan web-padawan commented Aug 14, 2025

Description

  • Changed dev folder to be another package in the monorepo and added build script
  • Extracted JS for generating dev/index.html and adding FOUC styles into separate file
  • Adjusted the enforceThemePlugin() replacements to not remove CSS matching ../

Type of change

  • Internal change

How to test

# Build dev/dist
yarn dev:build

# Build and start dev server
yarn dev:start

@web-padawan web-padawan force-pushed the chore/bundle-dev-pages branch from f861bfc to 2e0f6a1 Compare August 14, 2025 09:56
@web-padawan web-padawan marked this pull request as ready for review August 14, 2025 11:03
@web-padawan web-padawan force-pushed the chore/bundle-dev-pages branch 2 times, most recently from f6bb227 to 916aab8 Compare August 14, 2025 11:47
@web-padawan web-padawan changed the title chore: load Aura in dev pages by default, add build script chore: use private package for dev pages, add build script Aug 14, 2025
@web-padawan web-padawan force-pushed the chore/bundle-dev-pages branch from 916aab8 to 0744a13 Compare August 14, 2025 11:51
@@ -48,9 +48,10 @@ export const ElementMixin = (superClass) =>
window.Vaadin.registrations.push(this);
registered.add(is);

if (window.Vaadin.developmentModeCallback) {
const callback = window.Vaadin.developmentModeCallback;
if (callback) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without this change, I was getting the following error in the dist:

element-mixin-brp7V6lp.js:16 Uncaught TypeError: Cannot read properties of undefined (reading 'vaadin-usage-statistics')
    at f._callback (element-mixin-brp7V6lp.js:16:525)
    at element-mixin-brp7V6lp.js:11:1075

Storing the callback into variable fixes it.

@web-padawan web-padawan force-pushed the chore/bundle-dev-pages branch 2 times, most recently from cf458a6 to 7cedcef Compare August 14, 2025 13:47
"icons": "lerna run icons",
"lint": "npm-run-all --parallel lint:*",
"lint:css": "stylelint --ignore-path .gitignore \"packages/**/src/**/*.js\" \"packages/**/*.css\" \"dev/**/*.html\"",
"lint:js": "eslint",
"lint:types": "tsc",
"postinstall": "patch-package",
"prepare": "husky",
"serve:dist": "web-dev-server --app-index dist/index.html --open",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was a leftover from the old API docs which I missed to remove in #9975.

@web-padawan web-padawan force-pushed the chore/bundle-dev-pages branch from 7cedcef to 8bb680d Compare August 14, 2025 13:52
"postcss": "^8.1.0",
"postcss-import": "^16.1.1",
"rimraf": "^6.0.1",
"rollup": "^4.46.2"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also upgraded rollup to the latest version in yarn.lock (we had a pretty old one installed).

wds-utils.js Outdated
return html.replace(/<\/body>/u, `${preventFouc}\n</body>`);
}

export function generateListing(html, dir) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

common.js is not loaded on the listing page with yarn start:

Bildschirmfoto 2025-08-15 um 08 29 49

Copy link
Member Author

@web-padawan web-padawan Aug 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to use --root-dir dev - now dev pages will open as follows:

  • http://localhost:8000/ - index page
  • http://localhost:8000/button.html

IMO it's ok since we no longer have index.html in the root level workspace, and we no longer use web-dev-server for API docs after removal of old docs based on <iron-component-page>.

UPD: modified the web-dev-server.config..js to not break with yarn debug as in that case, dev pages are still available via old paths like http://localhost:8000/dev/button.html. I think it's probably fine.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like --root-dir dev breaks Lumo / Aura CSS using <link rel="stylesheet"> from parent folders, I'll investigate further how to make it work.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found a better solution using <base> tag which is only needed for localhost:8000/dev without a trailing slash. Reverted changes for --root-dir and modified the plugin to only inject <base> if needed.

Co-authored-by: Sascha Ißbrücker <sissbruecker@vaadin.com>
@web-padawan web-padawan force-pushed the chore/bundle-dev-pages branch from a54b914 to f0b2911 Compare August 15, 2025 07:24
@web-padawan web-padawan force-pushed the chore/bundle-dev-pages branch from f0b2911 to 1efe442 Compare August 15, 2025 08:31
Copy link

@web-padawan web-padawan merged commit 292805b into main Aug 15, 2025
9 checks passed
@web-padawan web-padawan deleted the chore/bundle-dev-pages branch August 15, 2025 10:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants