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

Support consola/utils subpath #143

Closed
imcm7 opened this issue Oct 4, 2023 · 4 comments · Fixed by #149
Closed

Support consola/utils subpath #143

imcm7 opened this issue Oct 4, 2023 · 4 comments · Fixed by #149

Comments

@imcm7
Copy link

imcm7 commented Oct 4, 2023

Environment

nux 3

Reproduction

reproduction

Describe the bug

Error: Could not load /home/nuxt-db-main/node_modules/.pnpm/unenv@1.7.4/node_modules/unenv/runtime/npm/consola/utils.mjs

Additional context

And people do that, for example https://github.com/kdydesign/nuxt-alias-module/blob/master/lib/logger.js

const consola = require('consola')
const { red, green } = require('chalk')
logger.info(`File ${red(fileName)} is ignored.`)

and not like here https://github.com/unjs/listhen/blob/248e6b3482f07a0f1f8c2e51a7a27c9791ec5a43/src/listen.ts#L11

import { ColorName, getColor, colors } from "consola/utils";
console.warn(colors.gray(" [copied to clipboard]"));

Logs

No response

@pi0
Copy link
Member

pi0 commented Oct 4, 2023

Hi. You should import from consola/utils (not consola/dist/utils) also your provided example seems CommonJS and not using either imports. Do you have a repo/branch that causes the issue?

@pi0 pi0 changed the title Unusable in nuxt import from consola/dist/utils Oct 4, 2023
@imcm7 imcm7 changed the title import from consola/dist/utils Error: Could not load /home/nuxt-db-main/node_modules/.pnpm/unenv@1.7.4/node_modules/unenv/runtime/npm/consola/utils.mjs Oct 4, 2023
@imcm7
Copy link
Author

imcm7 commented Oct 4, 2023

@pi0 sorry, that was first that I do, importing from consola/utils, I simply not revert my changes. It try to import consola utils from unenv/runtime/npm/consola/utils.mjs https://github.com/imcm7/nuxt-db/blob/308e735f5b2660570bb6aae8199d6ebd846d5f16/server/plugins/test.plugin.ts#L5

@reslear
Copy link

reslear commented Oct 25, 2023

same problem I'm sure the pnpm resolution is the problem

@imcm7
Copy link
Author

imcm7 commented Oct 26, 2023

same problem I'm sure the pnpm resolution is the problem

I use bun

@pi0 pi0 transferred this issue from unjs/consola Oct 26, 2023
@pi0 pi0 changed the title Error: Could not load /home/nuxt-db-main/node_modules/.pnpm/unenv@1.7.4/node_modules/unenv/runtime/npm/consola/utils.mjs Support consola/utils subpath Oct 26, 2023
@pi0 pi0 closed this as completed in #149 Nov 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants