ng-packagr / ng-packagr

Compile and package Angular libraries in Angular Package Format (APF)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Style exports after default module exports result in "Module not found: Error: Default condition should be last one"

silberjan opened this issue · comments

Type of Issue

[x] Bug Report
[ ] Feature Request

Description

In out built lib, the scss exports get moved after the default module exports in the final package.json:

  ...
  "exports": {
    "./package.json": {
      "default": "./package.json"
    },
    ".": {
      "types": "./index.d.ts",
      "esm2022": "./esm2022/lib-name.mjs",
      "esm": "./esm2022/lib-name.mjs",
      "default": "./fesm2022/lib-name.mjs",
      "sass": "./_index.scss"
    },
    ...
    

When using the lib in an angular project, ng serve throws multiple Error: Module not found: Error: Default condition should be last one errors.

Manually moving the default export to the end in the output package.json fixes the issue.

How To Reproduce

  • Build a library with style exports

Expected Behaviour

  • The styles should not come last in the exports

Version Information

ng-packagr: 16.1.0
@angular/*: 16.1.5
typescript: 5.1.6
rxjs: 7.8.1
node: 18.12.1
npm/yarn: 8.19.2

nevermind it was my own fault... we had a custom script in the build process that triggered this issue

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

This action has been performed automatically by a bot.