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

all alias plugins did not work #39142

Open
2 tasks done
ZreXoc opened this issue Oct 23, 2024 · 0 comments
Open
2 tasks done

all alias plugins did not work #39142

ZreXoc opened this issue Oct 23, 2024 · 0 comments
Labels
status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer type: bug An issue or pull request relating to a bug in Gatsby

Comments

@ZreXoc
Copy link

ZreXoc commented Oct 23, 2024

Preliminary Checks

Description

alias with plugin gatsby-plugin-alias-imports gatsby-plugin-module-resolver gatsby-plugin-root-import not work at all.

I know I should ask the authors of the plugins for help, but since all of them didn't work I guess that might be something with gatsby itself or I did something wrong.

Reproduction Link

https://github.com/ZreXoc/gatsby-import-repr

Steps to Reproduce

import Header from '@components/Header' with file struct

./src
├── components
│  └── Header.js
├── images
│  └── icon.png
└── pages
   ├── 404.js
   └── index.js

and gatsby-config.js :

/**
 * @type {import('gatsby').GatsbyConfig}
 */
module.exports = {
  siteMetadata: {
    title: `bug+repr`,
    siteUrl: `https://www.yourdomain.tld`,
  },
  plugins: [
    {
      resolve: "gatsby-plugin-root-import",
      options: {
        '@components': path.join(__dirname, "src", "components"),
      },
    },
  ],
}

Expected Result

import Header from '@components/Header' should be equal to import Header from '../components/Header'

Actual Result

❯ npm run develop

> [email protected] develop
> gatsby develop


 ERROR  UNKNOWN

(node:144490) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland
alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)



 ERROR  UNKNOWN

(node:144502) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland
alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)

⠦ compile gatsby files

 ERROR  UNKNOWN

(node:144521) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland
alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)

⠧ compile gatsby files
⠼ compile gatsby files

 ERROR  UNKNOWN

(node:144557) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland
alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)

success compile gatsby files - 1.867s

 ERROR #10123  API.CONFIG.LOADING

We encountered an error while trying to load your site's gatsby-config. Please fix the error and try again.



  ReferenceError: path is not defined
  
  - gatsby-config.js:13 Object.<anonymous>
    /home/xic/Documents/project/bug-repr/gatsby-config.js:13:24
  
  - loader:1546 Module._compile
    node:internal/modules/cjs/loader:1546:14
  
  - loader:1691 Object.Module._extensions..js
    node:internal/modules/cjs/loader:1691:10
  
  - loader:1317 Module.load
    node:internal/modules/cjs/loader:1317:32
  
  - loader:1127 Function.Module._load
    node:internal/modules/cjs/loader:1127:12
  
  - node:diagnostics_channel:315 TracingChannel.traceSync
    node:diagnostics_channel:315:14
  
  - loader:217 wrapModuleLoad
    node:internal/modules/cjs/loader:217:24
  
  - translators:329 cjsLoader
    node:internal/modules/esm/translators:329:5
  
  - translators:260 ModuleWrap.<anonymous>
    node:internal/modules/esm/translators:260:7
  
  - module_job:262 ModuleJob.run
    node:internal/modules/esm/module_job:262:25
  
  - loader:483 onImport.tracePromise.__proto__
    node:internal/modules/esm/loader:483:26
  
  - get-config-file.ts:50 attemptImport
    [bug-repr]/[gatsby]/src/bootstrap/get-config-file.ts:50:26
  
  - get-config-file.ts:98 attemptImportUncompiled
    [bug-repr]/[gatsby]/src/bootstrap/get-config-file.ts:98:24
  
  - get-config-file.ts:24 getConfigFile
    [bug-repr]/[gatsby]/src/bootstrap/get-config-file.ts:24:28
  
  - index.ts:22 loadConfig
    [bug-repr]/[gatsby]/src/bootstrap/load-config/index.ts:22:44
  
  - initialize.ts:184 initialize
    [bug-repr]/[gatsby]/src/services/initialize.ts:184:18
  

not finished load gatsby config - 0.053s

Environment

System:
    OS: Linux 6.11 Arch Linux
    CPU: (32) x64 13th Gen Intel(R) Core(TM) i9-13900HX
    Shell: 5.9 - /usr/bin/zsh
  Binaries:
    Node: 22.9.0 - /usr/bin/node
    Yarn: 1.22.22 - /usr/bin/yarn
    npm: 10.9.0 - /usr/bin/npm
  Languages:
    Python: 3.12.7 - /usr/bin/python
  npmPackages:
    gatsby: ^5.13.7 => 5.13.7
    gatsby-plugin-root-import: ^2.0.9 => 2.0.9


### Config Flags

_No response_
@ZreXoc ZreXoc added the type: bug An issue or pull request relating to a bug in Gatsby label Oct 23, 2024
@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Oct 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer type: bug An issue or pull request relating to a bug in Gatsby
Projects
None yet
Development

No branches or pull requests

2 participants
@ZreXoc and others