Skip to content

bug: Stencil build output contains comments and code is not minified #6242

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
bishalkar10 opened this issue Apr 18, 2025 · 0 comments
Open
3 tasks done
Labels
Bug: Validated This PR or Issue is verified to be a bug within Stencil Help Wanted

Comments

@bishalkar10
Copy link

Prerequisites

Stencil Version

4.7.0

Current Behavior

In our project the production build output is not minified. and it contains 100% of the comments in tsx files.

I read that in production minifyCss and minifyJs flags are by default true. But i still can see the comments in the build output files.
Image

Sample output code:
Image

Expected Behavior

I want the build output file to have a single line of Javascript --- no spaces, no indentation, no comments,

System Info

System: node 18.20.6
    Platform: windows (10.0.26100)
   CPU Model: 11th Gen Intel(R) Core(TM) i5-1135G7 @ 2.40GHz (8 cpus)
    Compiler: C:\Users\hidden-profile\Documents\hidden-project-name\node_modules\@stencil\core\compiler\stencil.js
       Build: 1740192295
     Stencil: 4.27.0
  TypeScript: 5.5.4
      Rollup: 2.56.3
      Parse5: 7.1.2
      jQuery: 4.0.0-pre
      Terser: 5.31.1

Steps to Reproduce

🐛 Steps to Reproduce

  1. Initialize a new Stencil project:

    npm init stencil
    
  2. Select the "component" starter when prompted.

  3. Navigate into the project directory:

    cd my-component
    
  4. Edit a component file, e.g. src/components/my-component/my-component.tsx, and add some comments:

     // This is a TypeScript comment
    
     render() {
       return (
         <div>
           {/* This is a JSX comment */}
           <p>Hello, World!</p>
         </div>
       );
     }
  5. Run the build:

    npm run build
    

Check the output files in dist/ folder

Code Reproduction URL

https://github.com/stenciljs/component-starter#

Additional Information

I have checked this Issue

@christian-bromann christian-bromann added Bug: Validated This PR or Issue is verified to be a bug within Stencil Help Wanted labels Apr 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug: Validated This PR or Issue is verified to be a bug within Stencil Help Wanted
Projects
None yet
Development

No branches or pull requests

2 participants