unjs / unenv

🕊️ Convert javaScript code to be runtime agnostic

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support `consola/utils` subpath

imcm7 opened this issue · comments

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

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 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

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

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

I use bun