Skip to content

[Bug?]: yarn does not respect publishConfig when using portal protocol #5641

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

Open
1 task
fourdim opened this issue Aug 5, 2023 · 1 comment
Open
1 task
Labels
bug Something isn't working

Comments

@fourdim
Copy link

fourdim commented Aug 5, 2023

Self-service

  • I'd be willing to implement a fix

Describe the bug

I'm planning to use a local package for development.

It's package.json looks like this:

{
  "main": "src/index.ts",
  "type": "module",
  "scripts": {
    "build": "tsc",
  },
  "keywords": [],
  "exports": {
    "./src/*": "./src/*.ts",
    ".": "./src/index.ts",
  },
  "publishConfig": {
    "access": "public",
    "main": "dist/index.js",
    "types": "dist/index.d.ts",
    "exports": {
      "./src/*": "./dist/*.js",
      ".": {
        "types": "./dist/index.d.ts",
        "module": "./dist/index.js",
        "import": "./dist/index.js"
      }
    }
  }
}

(This package is inside a workspace, so we need it's non-publish exports default to ts file)

When linking this package to a project by:

yarn link -p ../workspace/project-name

All the imports are resolved to ts file but not js file after build.

To reproduce

yarn link -p ../workspace/project-name

Environment

System:
    OS: Linux 6.4 Arch Linux
    CPU: (12) x64 11th Gen Intel(R) Core(TM) i7-11800H @ 2.30GHz
  Binaries:
    Node: 18.16.1 - /tmp/xfs-d4b44f58/node
    Yarn: 3.6.0 - /tmp/xfs-d4b44f58/yarn
    npm: 9.5.1 - ~/.config/nvm/versions/node/v18.16.1/bin/npm

Additional context

No response

@fourdim fourdim added the bug Something isn't working label Aug 5, 2023
@tomas-light
Copy link

Same to me. I use workspaces like:

project
│   package.json
│
└─── packages
│   └─── my-lib
│   │   └─── package.json
│   │   │   
│   │   └─── src
│   │   │   └─── index.ts
│   │   │
│   │   └─── dist
│   │       └─── index.js
│   │       └─── index.d.ts
│   │   
│   └─── my-tests-or-docs-or-something-else
│       │   └─── src
│       │   │   └─── index.ts

And it would be nice, If could use different export settings to use my-lib inside related workspaces and outisde, when it comes as a bundled package

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants