Skip to content

[webpack.cache.PackFileCacheStrategy] Caching failed for pack: Error: Can't resolve 'webpack.config.js' #4706

Description

@genyslt

Have you used AI?

None

Bug Description

After upgrade to "webpack-cli": "7.0.1", i got this error.

webpack-cli --config webpack.config.js - got warning and didnt cache [webpack.cache.PackFileCacheStrategy] Caching failed for pack: Error: Can't resolve 'webpack.config.js'
webpack-cli --config ./webpack.config.js works great

Link to Minimal Reproduction and step to reproduce

const _ = require('lodash');
const cfg = require('./vendor/myvendor/webpack/configs/webpack.config')(__dirname);

module.exports = _.merge(cfg, {
	entry: {
		app: path.resolve(__dirname, 'custom.ts')
	}
});```

### Expected Behavior

Cache with no problem, as it before

### Actual Behavior

Cache didnt work i `webpack-cli --config webpack.config.js`

### Environment

```shell
UBUNU

Is this a regression?

Yes (please specify version below)

Last Working Version

6.0.1

Additional Context

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions