How to make Meteor unignore package.json#imports inside dependencies?

In the course of my agent / server / client design pattern shift I want to remove console.log and go for isomorphic ( where appropriate ) asynchronous sequential Logger from day 0; but for today, I just put in a wrapper, and focus on the portability portion, to at least cover both agent and server for now.

matrix-bot-sdk has a logger already in use in at least one agent being ported ( which makes for a CLI by chat, and real-time interaction with the entire distributed application ) and it wisely and practically uses chalk because digital adulting does demands color in console logs… but… chalk uses package.json#imports like so:

Which is defined here:

And I already pretty much complained about here, but not the package.json#imports approach:

Now rather than having 3 places where I define path aliases I want to be more like chalk when I grow up, and use package.json#imports … BUT, then I see this, which might be on the Vite side ( @jorgenvatle ) and not Meteor proper:

Unable to resolve some modules:

  "#ansi-styles" in
/archive/01E/zero/code/ETC/decentrality/node_modules/chalk/source/index.js
(os.linux.x86_64)
  "#supports-color" in
/archive/01E/zero/code/ETC/decentrality/node_modules/chalk/source/index.js
(os.linux.x86_64)

If you notice problems related to these missing modules, consider running:

  meteor npm install --save #ansi-styles #supports-color

Notice how the suggestion would also not fix it, short of forking chalk and removing # from each and including the packages as dependencies ( which do exist on their own also )


Since I do not want to reference matrix-bot-sdk just to get its logger, I extracted and adapted the logger, but chalk itself is what introduces this package.json#imports issue.

Is there a known convention to get Meteor to respect package.json#imports for super vital things like chalk which one ought not be forced to forego in this life?

It does seem like there is discussion in the neighborhood of this issue in node itself which ought do the import based on the package.json but which Meteor has wrapped and taken charge of in meteor-tool


Going to root around a bit to see if there are tsconfig.json or vite.config.ts or .babelrc settings, but you see my problem now. Although I have plenty of hair still at the front end of “40” I would not pull any out over path aliases, whether for myself, or for downstream dependencies we all know and love. Like chalk!

This looks like Vite to start with, and my exact example is given in the comments:

Will work through the Vite portion then double-check at container build also.

Looks like the official term is subpath imports Modules: Packages | Node.js v23.1.0 Documentation

Seeing chalk brought up a lot and curious now, but this seems Vite specific until I can verify otherwise, so I am tracking here:

This has been an insane trip. Had to disable chalk but now having similar issues in the course of:

… with my own packages, because of the multi-builder issue versus shifting design to build potentially infinite agents same as with server and client entry points.

Right now I have 4 agents, and I feel like the import issues and two package systems and all that is going to be the straw that breaks the camel’s back on paradigm shifting.

At a certain point you ask “do I want it to work, or do I want this approach to work” and Meteor is feeling like technical debt on that point. But, giving myself until next Summer to “pivot or persevere” on that front.

Have not tried chalk again but have been using subpath imports myself, within the repository versus in a dependency ( which seems like the actual issue, subpath imports work fine, it is distantly related sub-sub-dependency subpath imports that are a pain ) … But it seems like I would just switch to a fork and remove that issue versus fuss with something ultra-minor which seems to be a stone in the shoe of a LOT of coders, and most of them citing chalk ( or Angular but less so, compared to chalk ) …

So I am going to call this solved and abandon, because in this case it is a fool’s errand to try to resolve this just to get colored console logs ( when I can fork and use an easily resolved reference ) since this is a “world pain” versus something solvable and stable. Solution is to recognize the problem and let it go, then circle back when it becomes valuable. For now, it is such a minor area that even if my fork went out of sync for years, I would likely feel no pain and no desire to get up to speed again. And using multi-entrypoint builds beyond client and server will be dismantling the code-space anyway and reflowing everything at the foundation, so this will be reapproached much more directly there, in import strategy between infinite possible applications sharing one environment.