Skip to content

Angular + Yarn pnp support #2885

@michaelfaith

Description

@michaelfaith

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"
  }

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions