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

custom loader hook not handling bare specifiers when resolve URLs (invalid URL) #1161

Closed
thescientist13 opened this issue Oct 7, 2023 · 0 comments · Fixed by #1162 or #1120
Closed
Assignees
Labels
alpha.5 bug Something isn't working CLI v0.29.0
Milestone

Comments

@thescientist13
Copy link
Member

Type of Change

Bug

Summary

Noticed as part of thescientist13/greenwood-htmx#7 that I was getting an invalid URL error, seemingly an error with bare specifiers?

➜  greenwood-htmx git:(import-css) yarn build
yarn run v1.22.19
$ node --experimental-loader ./node_modules/@greenwood/cli/src/loader.js ./node_modules/.bin/greenwood build
(node:81536) ExperimentalWarning: Custom ESM Loaders is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
{
  specifier: 'file:///Users/owenbuckley/Workspace/github/greenwood-htmx/node_modules/@greenwood/cli/src/index.js',
  context: {
    conditions: [ 'node', 'import', 'node-addons' ],
    importAssertions: [Object: null prototype] {},
    parentURL: undefined
  },
  parentURL: undefined
}
{
  specifier: './lifecycles/compile.js',
  context: {
    conditions: [ 'node', 'import', 'node-addons' ],
    importAssertions: [Object: null prototype] {},
    parentURL: 'file:///Users/owenbuckley/Workspace/github/greenwood-htmx/node_modules/@greenwood/cli/src/index.js'
  },
  parentURL: 'file:///Users/owenbuckley/Workspace/github/greenwood-htmx/node_modules/@greenwood/cli/src/index.js'
}
{
  specifier: 'fs/promises',
  context: {
    conditions: [ 'node', 'import', 'node-addons' ],
    importAssertions: [Object: null prototype] {},
    parentURL: 'file:///Users/owenbuckley/Workspace/github/greenwood-htmx/node_modules/@greenwood/cli/src/index.js'
  },
  parentURL: 'file:///Users/owenbuckley/Workspace/github/greenwood-htmx/node_modules/@greenwood/cli/src/index.js'
}
{
  specifier: 'commander',
  context: {
    conditions: [ 'node', 'import', 'node-addons' ],
    importAssertions: [Object: null prototype] {},
    parentURL: 'file:///Users/owenbuckley/Workspace/github/greenwood-htmx/node_modules/@greenwood/cli/src/index.js'
  },
  parentURL: 'file:///Users/owenbuckley/Workspace/github/greenwood-htmx/node_modules/@greenwood/cli/src/index.js'
}
node:internal/errors:484
    ErrorCaptureStackTrace(err);
    ^

TypeError [ERR_INVALID_URL]: Invalid URL
    at new NodeError (node:internal/errors:393:5)
    at URL.onParseError (node:internal/url:565:9)
    at new URL (node:internal/url:645:5)
    at resolve (file:///Users/owenbuckley/Workspace/github/greenwood-htmx/node_modules/@greenwood/cli/src/loader.js:55:58)
    at nextResolve (node:internal/modules/esm/loader:163:28)
    at ESMLoader.resolve (node:internal/modules/esm/loader:841:30)
    at ESMLoader.getModuleJob (node:internal/modules/esm/loader:424:18)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:76:40)
    at link (node:internal/modules/esm/module_job:75:36) {
  input: './lifecycles/compile.js',
  code: 'ERR_INVALID_URL'
}

Node.js v18.12.1
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Details

Not sure if this just the first time hitting this use case, but surprised only seeing it now.

Going to release this agains the v0.29.0 alpha release branch

@thescientist13 thescientist13 added bug Something isn't working CLI alpha.5 v0.29.0 labels Oct 7, 2023
@thescientist13 thescientist13 added this to the 1.0 milestone Oct 7, 2023
@thescientist13 thescientist13 self-assigned this Oct 7, 2023
@thescientist13 thescientist13 changed the title custom loader hook not handling bare specifiers (invalid URL) custom loader hook not handling bare specifiers when resolve URLs (invalid URL) Oct 7, 2023
@thescientist13 thescientist13 changed the title custom loader hook not handling bare specifiers when resolve URLs (invalid URL) custom loader hook not handling bare specifiers when resolve URLs (invalid URL) Oct 7, 2023
@thescientist13 thescientist13 mentioned this issue Oct 14, 2023
25 tasks
@thescientist13 thescientist13 linked a pull request Oct 14, 2023 that will close this issue
25 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment