all alias plugins did not work
Opened this issue · 0 comments
ZreXoc commented
Preliminary Checks
- This issue is not a duplicate. Before opening a new issue, please search existing issues: https://github.com/gatsbyjs/gatsby/issues
- This issue is not a question, feature request, RFC, or anything other than a bug report directly related to Gatsby. Please post those things in GitHub Discussions: https://github.com/gatsbyjs/gatsby/discussions
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
> bug-repr@1.0.0 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_