Skip to content

bug: Regression- Build output not as expected after stencil-core version V4.27.0 #6227

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

Open
3 tasks done
katteri-hpe opened this issue Apr 7, 2025 · 1 comment
Open
3 tasks done

Comments

@katteri-hpe
Copy link

Prerequisites

Stencil Version

V4.27.1 onwards

Current Behavior

We have updated the stencil/core to the latest 4.29.1 and could see the package.json inside the build output (loader) is missing. The latest version that has package.json is 4.27.0 .

We had to downgrade the package to 4.27.0 to have the expected build output.

Could you please take a look at this and please update the expected and right behavior for this build output? There is regression in our other components when the latest version of stencil/core is used without the package.json in the build output is used.

I have created a sandbox env where the previous version 4.27.0 is used and could see the package.json in the loader after building.

https://github.com/katteri-hpe/sandbox-table - Sandbox env V4.27.0

I have created another branch with the latest version 4.29.1, where you could see there is no package.json in the loader.

https://github.com/katteri-hpe/sandbox-table/tree/newbranch-v4.29.1 - V4.29.1

Expected Behavior

The expected behaviour is the build output having package.json in it.
https://github.com/katteri-hpe/sandbox-table - expected

System Info

Steps to Reproduce

The issue is reproduced in the repo and the branch provided.
Use V4.27.0 - to get the package.json in the build output
Use V27.1.0 (or any higher version) - for the build output without package.json in it.

Code Reproduction URL

https://github.com/katteri-hpe/sandbox-table/tree/newbranch-v4.29.1

Additional Information

No response

@johnjenkins
Copy link
Contributor

johnjenkins commented Apr 7, 2025

hi @katteri-hpe - this was an intended change, because the auto-added package.json within loader:

  1. was antiquated in it's assumptions (e.g. es2015, es2017, typings (instead of types), no exports etc)
  2. was not exposed or changeable by users (e.g. what if I want to add type: module)
  3. would override explicit settings from the main / parental package.json leading to bugs

You should be able to get the same functionality by exposing the loader dir from your main package.json:

Something like:

"files": [
    "loader/",
    ...
],
"exports": {
    "./loader": {
      "types": "./loader/index.d.ts",
      "import": "./loader/index.js",
      "require": "./loader/index.cjs.js"
    },
   ...

I think these settings are automatically added when new projects are setup using npm init stencil

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants