janl / mustache.js

Minimal templating with {{mustaches}} in JavaScript

Home Page:https://mustache.github.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

4.2.0 breaks pre-14.x code

Cireo opened this issue · comments

Might want to mention this in a release note. Had a nested dependency require "mustache": "^4.0.1" which broke something running on earlier npm when 4.1.0 went to 4.2.0

Error: No valid exports main found for '.../node_modules/mustache'

Hi @Cireo,

and thanks for reporting! 👍🏻

This is really something I'd like to get to the bottom of. The changes published in v4.2.0 was not meant to break already using projects, but rather allow more project using mustache. There is always a chance we did not consider certain usage scenarios.

Before we either update the release notes with migration notes or publish a new version fixing the issue, it's crucial for us to know what exploded on your end.

Would you mind sharing any details about your projects? Interesting aspects I can think of;

  1. versions of Node.js/npm
  2. Is there a build tool like webpack/rollup/etc involved?
  3. Are you using ES Modules w/import-syntax or good old CommonJS w/require()?

Have not been able to reproduce this kind of error you've reported yet.. Also verified in CI: #779.

Still very curious how your project is glued together, so please let us know if you've got a spare moment anytime soon.

I've tried to reproduce in smaller environments, but wasn't able to. Some extra context

  • The breaking version of Node was 12.x (upgrading to 14.x fixed the behavior)
  • Webpack had succeeded at build time (these were actually old versions of code that had been working in the past), but was not used in these particular environments, they built themselves from package.json requirements
  • The dependency chain was email-templates -> i18n -> mustache
  • npm was used, (pnpm shouldn't have been invoked, but was eventually present on the system)
  • Happened across multiple machines

I appreciate you looking into the issue, and will update if I can find a root cause.

I'm running into a perhaps related problem from eslint-plugin-import:

/Users/jwalton/project/src/components/root/routes/components/events/renderers/base.react.js
  2:22  error  Unable to resolve path to module 'mustache'  import/no-unresolved

/Users/jwalton/project/src/components/root/routes/components/events/renderers/transaction.react.js
  2:22  error  Unable to resolve path to module 'mustache'  import/no-unresolved

/Users/jwalton/project/src/components/root/routes/components/events/renderers/videoLinkItems.react.js
  3:22  error  Unable to resolve path to module 'mustache'  import/no-unresolved

Ahh, my import error is probably related to import-js/eslint-plugin-import#1868.