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

[Feature request] publishConfig overriding support #805

Closed
cometkim opened this issue Feb 18, 2021 · 4 comments · Fixed by #834
Closed

[Feature request] publishConfig overriding support #805

cometkim opened this issue Feb 18, 2021 · 4 comments · Fixed by #834

Comments

@cometkim
Copy link
Contributor

Hi 👋

I recently replaced my own rollup configuration with a microbundle and it's much simpler and just works!

However, there is a part that is not supported in the config I used frequently
In the previous config, I was using this in the package.json.

  "main": "./src/index.ts",
  "publishConfig": {
    "main": "./lib/index.js",
    "module": "./lib/index.mjs",
    "browser": "./lib/index.umd.js",
    "types": "./lib/index.d.ts",
    "access": "public"
  },

This pattern is helpful for monorepo tooling. For example, when I run all test suites for an entire package, this helps the test runner resolve monorepo dependency without an additional build step.

@developit
Copy link
Owner

I might be misunderstanding - how is this different than the existing package.json main/module/browser/unpkg fields we support?

@cometkim
Copy link
Contributor Author

When using monorepo, with tools like TypeScript, Jest, and whatever else

core
lib -> core

Suppose I have a newly downloaded repository or run git clean -fdx to do a fresh install.

Then, TypeScript cannot resolve the core package when working on lib because the local dependency has not yet been built, and it also fails when running test.

Using the source file in the main field and overriding it in publishConfig can provide a smart separation of local development and publish environments, so can be useful for some monorepo configurations.

I've learned this pattern from https://github.com/yarnpkg/berry

@cometkim
Copy link
Contributor Author

Obviously, this is optional. And I believe it will not break existing configs.

Can I make a patch for it?

@developit
Copy link
Owner

Sure, Seems reasonable.

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.

2 participants