cornerstone icon indicating copy to clipboard operation
cornerstone copied to clipboard

stencil.conf.cjs missing after git clone or download of bundled theme (Stencil CLI 8+ with Node 20)

Open hiimbomb1999 opened this issue 11 months ago • 2 comments

I'm experiencing an issue with the latest version of Stencil CLI (v8.x and above) when using Node.js 20.

When I clone a theme using git clone or download a bundled theme (i.e., a theme that has already been compiled and is ready for upload), the stencil.conf.cjs file is missing from the theme directory. This prevents me from running stencil bundle or other CLI commands unless I manually copy the stencil.conf.cjs file from the original unbundled version.

This issue seems to have started occurring after the Stencil CLI version 8.0 update. In previous versions, this configuration file was always retained even in the bundled theme directory.

Steps to Reproduce:

Clone or download a bundled theme repository.

Attempt to run stencil bundle.

Observe that stencil.conf.cjs is missing, causing the CLI to throw an error.

Environment:

Node.js: 20.x

Stencil CLI: 8.x (latest)

OS: [Your OS, optional]

Expected Behavior: The stencil.conf.cjs file should be retained after bundling or included when cloning/downloading a bundled theme so that developers can continue to use Stencil CLI commands without manually restoring the file.

Actual Behavior: stencil.conf.cjs is missing, which requires manual copying from the original source to proceed.

hiimbomb1999 avatar Apr 08 '25 03:04 hiimbomb1999

@hiimbomb1999 As a workaround, you can make a copy of stencil.conf.js and just rename it to stencil.conf.cjs.

Related stencil-cli issue: https://github.com/bigcommerce/stencil-cli/issues/1236

Note: Doing git clone shouldn't cause this problem if the repo you're cloning contains stencil.conf.cjs, and cornerstone does include it as of Jan. 7, 2025. If it's your repo, you can have both file extensions(stencil.conf.js and stencil.conf.cjs) in the theme so it runs with older versions of stencil-cli as well. Also, when possible I recommend git cloning your theme rather than downloading it from the BigCommerce control panel to run it locally. There are a few other problems that happen when you download a theme from the control panel:

  1. BigCommerce will automatically add end-of-file newlines to every file in the theme when you download, even binary files like font files and images... which can mean font files get corrupted. I opened a case about this with BC support, but the issue persists.
  2. The downloaded bundle will be missing the grunt folder so grunt svgstore won't work and some configuration files will be missing.
  3. The downloaded bundle will include files you don't need or want... mainly the /parsed folder... and since /parsed isn't in .gitignore you might accidentally commit it to your git repo... and searching with parsed files present puts a bunch of garbage in the search results.

pvaladez avatar Jun 11 '25 03:06 pvaladez

@pvaladez Thank you.

hiimbomb1999 avatar Jun 13 '25 05:06 hiimbomb1999