Skip to content

filename and chunkFilename functions #417

Closed
@aaarichter

Description

@aaarichter
  • Operating System:
  • Node Version: 10.15.1
  • NPM Version: 6.9.0
  • webpack Version: 4.23.x
  • mini-css-extract-plugin Version: 0.7.0 (and 0.6.0)

So I have been upgrading from version 0.2.0 step by step until 0.7.0. I noticed that in between the minor versions the filename and chunkname functionality changed or broke when replacement functions are used. Updating to the latest I see errors like

ERROR in chunk --css--ecard-touch [entry]
({
  chunk: chunkData
}) => this.options.moduleFilename(chunkData)
path.replace is not a function

Expected Behavior

No error and stable behavior of those replacer. (tbh I froze the version due to buggy behavior in between minor versions)

On such errors the call stack should be outputted too.

Actual Behavior

Errors are shown.

Code

  // webpack.config.js

      new MiniCssExtractPlugin({
        filename({ chunk }) {
          const name = chunk.name.replace(/^--css--/, '');
          return `${name}${contentHashPattern}.css`;
        },
        chunkFilename() {
          return `[name]${contentHashPattern}.css`;
        },
        allChunks: true,
      }),

How Do We Reproduce?

No idea, I just upgraded and got the error when running webpack

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions