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

Angular + Yarn pnp support #2885

Closed
michaelfaith opened this issue Jul 19, 2023 · 0 comments · Fixed by #3035
Closed

Angular + Yarn pnp support #2885

michaelfaith opened this issue Jul 19, 2023 · 0 comments · Fixed by #3035
Labels

Comments

@michaelfaith
Copy link
Contributor

michaelfaith commented Jul 19, 2023

Marked version: 4.3.0 (via ngx-markdown)

Describe the bug
Currently, the marked.min.js file isn't being exported from the package, which makes it hard to use in Angular applications with Yarn PnP. Angular will load scripts declared in their angular.json if that script is exported. Currently the exports are only the following:

"exports": {
    ".": {
      "import": "./lib/marked.esm.js",
      "default": "./lib/marked.cjs"
    },
    "./bin/marked": "./bin/marked.js",
    "./package.json": "./package.json"
  }

So I end up with an error when I declare marked/marked.min.js

"scripts": [
  "marked/marked.min.js",
  "prismjs/prism.js",
  "prismjs/components/prism-json.min.js",
  "prismjs/components/prism-scss.min.js",
  "prismjs/components/prism-typescript.min.js"
],

The prism scripts load ok, but for the marked script I get this error:

Error: Package path ./marked.min.js is not exported from package .yarn\cache\marked-npm-4.3.0-da40d83667-0db6817893.zip\node_modules\marked\ (see exports field in .yarn\cache\marked-npm-4.3.0-da40d83667-0db6817893.zip\node_modules\marked\package.json)

Proposal
I'm proposing simply adding the marked.min.js to the package export list:

"exports": {
    ".": {
      "import": "./lib/marked.esm.js",
      "default": "./lib/marked.cjs"
    },
    "./marked.min.js": "./marked.min.js",
    "./bin/marked": "./bin/marked.js",
    "./package.json": "./package.json"
  }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants