chromaui/chromatic-cli

Publish to Chromatic fails with error: Cannot find module 'clean-webpack-plugin'

Opened this issue · 3 comments

Description:
Encountering a 'clean-webpack-plugin' module not found error while attempting to publish a library to Chromatic using 'chromaui/action@v1' in a GitHub Actions workflow. The issue arises during the webpack build process before the Chromatic publishing step.

Error Log:

`$ webpack
[webpack-cli] Failed to load '/home/runner/work/bionic-design/bionic-design/webpack.config.js' config
[webpack-cli] Error: Cannot find module 'clean-webpack-plugin'
Require stack:

  • /home/runner/work/bionic-design/bionic-design/webpack.config.js
  • /usr/local/lib/node_modules/webpack-cli/lib/webpack-cli.js
  • /usr/local/lib/node_modules/webpack-cli/lib/bootstrap.js
  • /usr/local/lib/node_modules/webpack-cli/bin/cli.js
  • /usr/local/lib/node_modules/webpack/bin/webpack.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1077:15)
    at Module._load (node:internal/modules/cjs/loader:922:27)
    at Module.require (node:internal/modules/cjs/loader:1143:19)
    at require (node:internal/modules/cjs/helpers:119:18)
    at Object. (/home/runner/work/bionic-design/bionic-design/webpack.config.js:2:32)
    at Module._compile (node:internal/modules/cjs/loader:1256:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
    at Module.load (node:internal/modules/cjs/loader:1119:32)
    at Module._load (node:internal/modules/cjs/loader:960:12)
    at Module.require (node:internal/modules/cjs/loader:1143:19) {
    code: 'MODULE_NOT_FOUND',
    requireStack: [
    '/home/runner/work/bionic-design/bionic-design/webpack.config.js',
    '/usr/local/lib/node_modules/webpack-cli/lib/webpack-cli.js',
    '/usr/local/lib/node_modules/webpack-cli/lib/bootstrap.js',
    '/usr/local/lib/node_modules/webpack-cli/bin/cli.js',
    '/usr/local/lib/node_modules/webpack/bin/webpack.js'
    ]
    }
    error Command failed with exit code 2.
    info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
    error Command failed with exit code 2.
    info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
    Error: non-zero exit code`

Context:

'clean-webpack-plugin' is specified in the project's package.json.
The package is recognized in a previous step before the Chromatic publishing.
The workflow uses 'chromaui/action@v1' for Chromatic integration.
Expected Behavior:
The webpack build should successfully recognize and load the 'clean-webpack-plugin' module during the Chromatic publishing workflow.

Steps to Reproduce:

GitHub Actions workflow using 'chromaui/action@v1.'
Include Chromatic publishing step.
Ensure 'clean-webpack-plugin' is listed in package.json.
Run the workflow and observe the error during the webpack build.
Additional Information:
Workflow and relevant configuration files are available for further analysis upon request.

Thank you for your prompt attention to this matter.

Best regards,
Tamar Cohen

same problem

same

Hi folks, does this issue still happen when using chromaui/action@latest instead of chromaui/action@v1? We've recently updated our CI documentation to recommend using @latest, along with a couple of other small changes to the example file that you may want to follow.