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

Issue with yarn and path building #6782

Closed
Willix-IT opened this issue Jan 10, 2023 · 13 comments · Fixed by #6930
Closed

Issue with yarn and path building #6782

Willix-IT opened this issue Jan 10, 2023 · 13 comments · Fixed by #6930
Assignees
Labels
Milestone

Comments

@Willix-IT
Copy link

Describe the bug

Since the last update (1.3.25), i was not able to yarn dev my app.
I got the following :

node:internal/errors:491
    ErrorCaptureStackTrace(err);
    ^

TypeError [ERR_INVALID_FILE_URL_PATH]: File URL path must be absolute
    at new NodeError (node:internal/errors:400:5)
    at getPathFromURLWin32 (node:internal/url:1463:11)
    at fileURLToPath (node:internal/url:1493:22)
    at finalizeResolution (node:internal/modules/esm/resolve:296:14)
    at moduleResolve (node:internal/modules/esm/resolve:945:10)
    at defaultResolve (node:internal/modules/esm/resolve:1153:11)
    at nextResolve (node:internal/modules/esm/loader:163:28)
    at ESMLoader.resolve (node:internal/modules/esm/loader:842:30)
    at ESMLoader.getModuleJob (node:internal/modules/esm/loader:424:18)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:77:40) {
  code: 'ERR_INVALID_FILE_URL_PATH'
}

After taking a closer look, i figured out it was due to bad paths created by SWC.
Paths created were all as the following :

import{loadPlugins,restartJobs}from"//?/C:/Users/si201/Documents/Airthium/tanatloc/src/lib/plugins"

To fix it, I went back to the previous version, 1.3.24

Input code

No response

Config

{
  "exclude": ["__tests__", "config/jest", "config/depcheck"],
  "minify": true,
  "jsc": {
    "parser": {
      "syntax": "typescript",
      "tsx": true,
      "dynamicImport": true
    },
    "target": "es2020",
    "baseUrl": "./",
    "paths": {
      "@/config": ["config"],
      "@/config/*": ["config/*"],
      "@/models": ["models"],
      "@/models/*": ["models/*"],
      "@/templates": ["templates"],
      "@/templates/*": ["templates/*"],
      "@/plugins": ["plugins"],
      "@/plugins/*": ["plugins/*"],
      "@/postprocessing": ["postprocessing"],
      "@/postprocessing/*": ["postprocessing/*"],
      "@/api": ["src/api"],
      "@/api/*": ["src/api/*"],
      "@/auth": ["src/auth"],
      "@/auth/*": ["src/auth/*"],
      "@/components": ["src/components"],
      "@/components/*": ["src/components/*"],
      "@/context": ["src/context"],
      "@/context/*": ["src/context/*"],
      "@/database": ["src/database"],
      "@/database/*": ["src/database/*"],
      "@/lib": ["src/lib"],
      "@/lib/*": ["src/lib/*"],
      "@/pages": ["src/pages"],
      "@/pages/*": ["src/pages/*"],
      "@/route": ["src/route"],
      "@/route/*": ["src/route/*"],
      "@/server": ["src/server"],
      "@/server/*": ["src/server/*"],
      "@/services": ["src/services"],
      "@/services/*": ["src/services/*"],
      "@/styles": ["src/styles"],
      "@/styles/*": ["src/styles/*"]
    }
  },
  "module": {
    "type": "es6"
  },
  "sourceMaps": true
}

Playground link

No response

Expected behavior

As usual, i tried yarn + yarn dev to run my app. It should build and run without any further behaviour.

Actual behavior

It crashes as soon SWC files are all compiled, throwing the error i pasted above.

Successfully compiled: 9 files with swc (27.14ms)
Successfully compiled: 483 files with swc (995.45ms)
Successfully compiled: 9 files with swc (22.58ms)
Successfully compiled: 5 files with swc (27.95ms)
Successfully compiled: 1 file, copied 3 files with swc (16.69ms)
Successfully compiled: 2 files, copied 28 files with swc (29.74ms)
node:internal/errors:491
    ErrorCaptureStackTrace(err);
    ^

TypeError [ERR_INVALID_FILE_URL_PATH]: File URL path must be absolute
    at new NodeError (node:internal/errors:400:5)
    at getPathFromURLWin32 (node:internal/url:1463:11)
    at fileURLToPath (node:internal/url:1493:22)
    at finalizeResolution (node:internal/modules/esm/resolve:296:14)
    at moduleResolve (node:internal/modules/esm/resolve:945:10)
    at defaultResolve (node:internal/modules/esm/resolve:1153:11)
    at nextResolve (node:internal/modules/esm/loader:163:28)
    at ESMLoader.resolve (node:internal/modules/esm/loader:842:30)
    at ESMLoader.getModuleJob (node:internal/modules/esm/loader:424:18)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:77:40) {
  code: 'ERR_INVALID_FILE_URL_PATH'
}

Version

1.3.25

Additional context

No response

@kdy1
Copy link
Member

kdy1 commented Jan 10, 2023

#5165

@kdy1 kdy1 closed this as not planned Won't fix, can't repro, duplicate, stale Jan 10, 2023
@Willix-IT
Copy link
Author

#5165

This is not the same issue. In 1.3.24, i had relative paths, and now they are created with question marks as the following :

//?/C:/Users/si201/Documents/Airthium/tanatloc/src/lib/plugins

@kdy1 kdy1 reopened this Jan 10, 2023
@kdy1 kdy1 added this to the Planned milestone Jan 10, 2023
@kdy1 kdy1 self-assigned this Jan 11, 2023
@kdy1
Copy link
Member

kdy1 commented Jan 11, 2023

I think #6716 is the cause

@ivan-mosayc

This comment was marked as spam.

@kdy1
Copy link
Member

kdy1 commented Feb 8, 2023

Can you provide a repro?

@kdy1
Copy link
Member

kdy1 commented Feb 8, 2023

I'll open this once you provide a repro

@kdy1 kdy1 closed this as not planned Won't fix, can't repro, duplicate, stale Feb 8, 2023
@kdy1 kdy1 removed this from the Planned milestone Feb 8, 2023
@sgarnotel
Copy link

Seems to be the same as #6858

Here is a repro https://github.com/Airthium/swc-issue_6782
You can have a look on Github Actions to directly see the result on Linux (working) and Windows (fail) https://github.com/Airthium/swc-issue_6782/actions/runs/4134348336

@realtimetodie
Copy link
Contributor

It is ludicrous to revert a bugfix because a single badly configured user app fails to build.

@sgarnotel
Copy link

@realtimetodie Can you tell me what seems to be "badly configured" ? For me a dev environment working on Linux but not on Windows reveals a bug, but I can be wrong.

And there is at least 3 people with this bug, just wrapping quickly the issues.

Clearly, revert a bugfix is a little rough.

@realtimetodie
Copy link
Contributor

It is unproven that your app is not badly configured, this is just your personal assumption.

@kdy1
Copy link
Member

kdy1 commented Feb 10, 2023

It's not badly configured, it works well on unix

@sgarnotel
Copy link

Clearly the project should be miss-configured, I am open to any suggestions to improve it.

I do not understand the goal of your comments...

kdy1 added a commit that referenced this issue Feb 11, 2023
**Related issue:**

 - Reverts #6716.
 - Closes #6782.
@kdy1 kdy1 modified the milestones: Planned, v1.3.36 Feb 21, 2023
@swc-bot
Copy link
Collaborator

swc-bot commented Mar 23, 2023

This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@swc-project swc-project locked as resolved and limited conversation to collaborators Mar 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development

Successfully merging a pull request may close this issue.

6 participants