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

Unable to resolve path to module 'unbuild'. #2620

Closed
Plasticine-Yang opened this issue Dec 26, 2022 · 1 comment
Closed

Unable to resolve path to module 'unbuild'. #2620

Plasticine-Yang opened this issue Dec 26, 2022 · 1 comment

Comments

@Plasticine-Yang
Copy link

Plasticine-Yang commented Dec 26, 2022

I have an error - Unable to resolve path to module 'unbuild'.

I encountered this error when trying to import the package 'unbuild', but it is normal to import other packages.

Could you please check it?

My files:

package.json

{
  "name": "@plasticine-yang/eslint-config-basic-playground",
  "version": "0.0.0",
  "type": "module",
  "private": true,
  "packageManager": "pnpm@7.1.0",
  "author": "Plasticine-Yang",
  "license": "MIT",
  "devDependencies": {
    "@plasticine-yang/eslint-config-basic": "workspace:*",
    "unbuild": "^1.0.2"
  }
}

.eslintrc.cjs

/** @type { import('eslint').ESLint.ConfigData } */
module.exports = {
  env: {
    es6: true,
    browser: true,
    node: true,
  },

  extends: ['eslint:recommended', 'plugin:import/recommended'],

  settings: {
    'import/resolver': {
      node: { extensions: ['.js', '.cjs', '.mjs'] },
    },
  },
}

image

@ljharb
Copy link
Member

ljharb commented Dec 26, 2022

The issue here is that this package doesn't specify a "main", only "exports", which makes it not backwards-compatible.

This plugin uses resolve, which does not yet support exports, so it's not yet capable of resolving this package.

Eventually, resolve will support it, but a better solution is for unbuild to support pre-exports nodes by supplying a "main".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants