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

invalid URL when using SSR custom imports #1042

Closed
thescientist13 opened this issue Jan 15, 2023 · 0 comments · Fixed by #1043
Closed

invalid URL when using SSR custom imports #1042

thescientist13 opened this issue Jan 15, 2023 · 0 comments · Fixed by #1043
Assignees
Labels
bug Something isn't working CLI documentation Greenwood specific docs P0 Critical issue that should get addressed ASAP SSR v0.27.3
Milestone

Comments

@thescientist13
Copy link
Member

thescientist13 commented Jan 15, 2023

Type of Change

Bug

Summary

Getting this error trying to make a plugin for a custom SSR loader (for SVGs). Looks like baseURL is undefined in loader.js?

promises:279
            triggerUncaughtException(err, true /* fromPromise */);
            ^
TypeError [ERR_INVALID_URL]: Invalid URL
    at new NodeError (node:internal/errors:387:5)
    at URL.onParseError (node:internal/url:564:9)
    at parse (<anonymous>)
    at new URL (node:internal/url:640:5)
    at resolve (file:///Users/analogstudios/Workspace/analogstudios/repos/www.tuesdaystunes.tv/node_modules/@greenwood/cli/src/loader.js:25:12)
    at nextResolve (node:internal/modules/esm/loader:165:28)
    at ESMLoader.resolve (node:internal/modules/esm/loader:844:30)
    at ESMLoader.getModuleJob (node:internal/modules/esm/loader:431:18)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:76:40)
    at link (node:internal/modules/esm/module_job:75:36) {
  input: '../../assets/icons/facebook.svg',
  code: 'ERR_INVALID_URL'
}

Details

Looks like baseURL is undefined in loader.js is undefined when logging out?

{
  baseURL: undefined,
  parentURL: 'file:///Users/analogstudios/Workspace/analogstudios/repos/www.tuesdaystunes.tv/src/components/social-links/social-links.js'
}

Did a quick check, and looks like it has changed to parentURL as of v16.19

context [<Object>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)
- `conditions` [<string[]>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Export conditions of the relevant package.json
- `importAssertions` [<Object>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)
- `parentURL` [<string>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [<undefined>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Undefined_type) The module importing this one, or undefined if this is the Node.js entry point
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 P0 Critical issue that should get addressed ASAP SSR v0.27.3
Projects
Development

Successfully merging a pull request may close this issue.

1 participant