Skip to content
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

bug/issue 1151 custom imports not working for API routes and SSR pages #1152

Conversation

thescientist13
Copy link
Member

@thescientist13 thescientist13 commented Sep 10, 2023

Related Issue

resolves #1151

Summary of Changes

  1. Added support for using custom imports for CSS and JS with test cases
  2. Vendor @web/rollup-plugin-import-meta-assets plugin
  3. Added support for bundling new URL for script assets

TODO

  1. Lit tests are failing?
  2. Windows specs are failing
  3. Refactor import meta assets dependency / dependency
    • estree -> acorn walk?
    • Magic String?
    • remove dep from package.json / rollup.config.js
  4. refactoring / TODOs
    • why do we have to make an /api/assets folder? (already fixed in 0.29.0-rc.1)
    • "common" plugins are being duplicated? including common plugins?
  5. clean up console logging
  6. Document usage of new URL for assets (plus move TS test case to CLI) - Isomorphic Asset Bundling #1163
    • hmm, how to best handle for nested routes (e.g. /some-path)?

Thoughts / Questions

  1. need to support more than just JS for emitting chunks in import meta assets?
  2. loader imports bug seen from the reproduction (should track as own issue) - custom loader hook not handling bare specifiers when resolve URLs (invalid URL) #1161

@thescientist13 thescientist13 added bug Something isn't working Plugins Greenwood Plugins CLI SSR labels Sep 10, 2023
@thescientist13 thescientist13 self-assigned this Sep 10, 2023
@thescientist13 thescientist13 marked this pull request as draft September 10, 2023 00:34
@thescientist13 thescientist13 added the question Further information is requested label Sep 23, 2023
@thescientist13 thescientist13 marked this pull request as ready for review September 23, 2023 15:24
@thescientist13 thescientist13 added enhancement Improve something existing (e.g. no docs, new APIs, etc) documentation Greenwood specific docs labels Sep 30, 2023
@thescientist13 thescientist13 force-pushed the bug/issue-1151-custom-imports-not-working-for-api-routes-and-ssr-pages branch from 0db10d4 to 3687185 Compare October 6, 2023 23:44
@thescientist13 thescientist13 removed the question Further information is requested label Oct 8, 2023
@thescientist13 thescientist13 force-pushed the bug/issue-1151-custom-imports-not-working-for-api-routes-and-ssr-pages branch from f408fb3 to 99d927a Compare October 14, 2023 00:01
@thescientist13 thescientist13 merged commit 3432617 into release/0.29.0 Oct 14, 2023
7 checks passed
@thescientist13 thescientist13 deleted the bug/issue-1151-custom-imports-not-working-for-api-routes-and-ssr-pages branch October 14, 2023 00:17
thescientist13 added a commit that referenced this pull request Nov 9, 2023
#1152)

* custom imports for API routes and SSR pages and custom css import test cases

* add test cases for import json plugin

* all specs passing

* refactor rollup id cleaning

* import meta url refactoring

* normalize bundled import meta URL paths for Windows

* full bundling support for custom imports

* update final TODO comments

* leverage custom imports that can serve for meta import chunk vs asset bundling

* refactor custom import detection for found assetUrls

* add test case for bundling images with new URL

* document new URL and import.meta.url pattern

* clarify docs on new URL usage patterns and general content around assets

* fix windows specs

* callout support for isomorphic asset bundling in docs

---------

Co-authored-by: Owen Buckley <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working CLI documentation Greenwood specific docs enhancement Improve something existing (e.g. no docs, new APIs, etc) Plugins Greenwood Plugins SSR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

custom imports bundling breaks when used in API routes and SSR pages
1 participant