Laravel Mix: Module build failed: Error: missing '{'

I encountered this issue when running production on Laravel Mix:

However, this seems to be an standing issue:

Module build failed: Error: missing ‘{‘

[email protected] is explicitly using the engine: rework for some perceived backwards compatibility, even though the engine: postcss should be the safer option.

Here is temporary workaround for now until the ‘rework’ engine is removed. Put the following in your mix file. This lets you change the engine before any files are processed without having to muck about in the source code.

Mix.listen('configReady', webpackConfig => {
  webpackConfig.module.rules.forEach(rule => {
    if (Array.isArray(rule.use)) {
      rule.use.forEach(ruleUse => {
        if (ruleUse.loader === 'resolve-url-loader') {
          ruleUse.options.engine = 'postcss';