-
Notifications
You must be signed in to change notification settings - Fork 12
fix(edge-apps-library): set Vite output format to IIFE to prevent import.meta errors #662
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(edge-apps-library): set Vite output format to IIFE to prevent import.meta errors #662
Conversation
…brary Move all build configurations from clock and weather apps to edge-apps-library. All config files removed from apps - edge-apps-scripts now handles everything. Changes: - Create shared Vite plugins (screenly-mock, copy-manifest, component-resolve, css-alias) - Add centralized configs (vite, eslint, postcss, tailwind, tsconfig) - Update edge-apps-scripts to use library configs and create temp tsconfig on-the-fly - Remove all local config files from clock and weather apps - Update clock/weather package.json to use edge-apps-scripts for build and lint - Add autoprefixer, postcss, @tailwindcss/postcss, and yaml to library dependencies
PR Reviewer Guide 🔍(Review updated until commit cee67e6)Here are some key observations to aid the review process:
|
|
Persistent review updated to latest commit cee67e6 |
PR Code Suggestions ✨Latest suggestions up to cee67e6
Previous suggestionsSuggestions up to commit cee67e6
|
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.
Pull request overview
This PR centralizes build configurations from the clock and weather apps into the edge-apps-library, reducing duplication and establishing a shared configuration pattern. The changes move Vite plugins, ESLint, PostCSS, Tailwind, and TypeScript configs to a central location, with edge-apps-scripts managing builds and linting.
Changes:
- Created four shared Vite plugins (screenly-mock, copy-manifest, component-resolve, css-alias) and exported them from edge-apps-library
- Added centralized configuration files (vite.config.with-plugins.ts, eslint.config.base.ts, postcss.config.js, tailwind.config.base.js, tsconfig.vite-app.json)
- Updated edge-apps-scripts build and type-check commands to use centralized configs, with dynamic tsconfig generation for type checking
- Removed all local config files from clock and weather apps, updating their package.json to use edge-apps-scripts for build and lint
Reviewed changes
Copilot reviewed 20 out of 22 changed files in this pull request and generated 13 comments.
Show a summary per file
| File | Description |
|---|---|
| edge-apps/weather/vite.config.ts | Removed - moved to centralized config |
| edge-apps/weather/tsconfig.json | Removed - apps now use centralized tsconfig via CLI |
| edge-apps/weather/tailwind.config.js | Removed - uses base tailwind config |
| edge-apps/weather/postcss.config.js | Removed - PostCSS config now in centralized vite config |
| edge-apps/weather/package.json | Updated build and lint scripts to use edge-apps-scripts |
| edge-apps/weather/eslint.config.ts | Removed - uses library's eslint config via CLI |
| edge-apps/clock/vite.config.ts | Removed - moved to centralized config |
| edge-apps/clock/tailwind.config.js | Removed - uses base tailwind config |
| edge-apps/clock/package.json | Updated build and lint scripts to use edge-apps-scripts |
| edge-apps/edge-apps-library/src/vite-plugins/* | Created shared plugins extracted from app configs |
| edge-apps/edge-apps-library/configs/vite.config.with-plugins.ts | New centralized Vite config with all plugins and PostCSS setup |
| edge-apps/edge-apps-library/configs/tsconfig.vite-app.json | New centralized TypeScript config for Vite apps (upgraded to ES2022) |
| edge-apps/edge-apps-library/configs/eslint.config.base.ts | New base ESLint config for apps |
| edge-apps/edge-apps-library/configs/tailwind.config.base.js | Added default content paths to base config |
| edge-apps/edge-apps-library/scripts/cli.ts | Updated build commands to use centralized vite config; added dynamic tsconfig generation for type checking |
| edge-apps/edge-apps-library/package.json | Added PostCSS/Tailwind dependencies and vite-plugins export |
Comments suppressed due to low confidence (1)
edge-apps/edge-apps-library/configs/tsconfig.vite-app.json:6
- The TypeScript target and lib have been changed from ES2020 to ES2022. This change introduces newer JavaScript features (like top-level await, class static blocks, etc.) that may not be supported in all target browsers or runtime environments where the edge apps will run. Ensure that all target platforms for Screenly Edge Apps support ES2022 features, or configure Vite to transpile to a lower target during the build process. If backwards compatibility is important, consider keeping ES2020 or documenting the minimum supported environments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
edge-apps/edge-apps-library/configs/vite.config.with-plugins.ts
Outdated
Show resolved
Hide resolved
edge-apps/edge-apps-library/configs/vite.config.with-plugins.ts
Outdated
Show resolved
Hide resolved
…ort.meta errors Added explicit `format: 'iife'` to the Vite build configuration to ensure compatibility with non-module script tags. Without this, Vite defaults to ESM output which includes import.meta, causing "Cannot use 'import.meta' outside a module" errors when scripts are loaded without type="module". Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
User description
Move all build configurations from clock and weather apps to edge-apps-library. All config files removed from apps - edge-apps-scripts now handles everything.
Changes:
PR Type
Enhancement
Description
Centralize Vite config under
configs/Add shared Vite plugins (mock, manifest, aliases)
Update
edge-apps-scriptsbuild and typecheckRemove clock/weather local config files
Diagram Walkthrough
File Walkthrough
12 files
Remove app-local Vite config and pluginsAdd shared base ESLint flat configRemove app-local ESLint configurationRemove app-local Vite config and pluginsRemove app-local Tailwind configurationAdd default Tailwind `content` globsRemove app-local PostCSS configurationRemove app-local Tailwind config extension fileSwitch build/lint scripts to `edge-apps-scripts`Bump TS target/lib and remove app pathsSwitch build/lint scripts to `edge-apps-scripts`Remove app-local TypeScript configuration7 files
Add centralized Vite config with shared pluginsUse shared Vite config and temp tsconfigAdd plugin resolving library `.js` to `.ts`Add plugin copying `screenly.yml` manifestsAdd plugin resolving styles alias in CSSExport shared Vite plugins barrelAdd dev middleware generating mocked `screenly.js`1 files
Minor formatting cleanup in PostCSS config1 files
Export `./vite-plugins` and add build dependencies