Skip to content

Error: should have required property 'replacement' #18

@kathom-universe

Description

@kathom-universe

When building for production using vue-cli-service build, the following error is thrown:

Module build failed (from ./node_modules/thread-loader/dist/cjs.js):
Thread Loader (Worker 0)
Invalid options
  [options.]: should have required property 'replacement'
 undefined
    at PoolWorker.fromErrorObj (/app/core/frontend/node_modules/thread-loader/dist/WorkerPool.js:262:12)
    at /app/core/frontend/node_modules/thread-loader/dist/WorkerPool.js:204:29
    at mapSeries (/app/core/frontend/node_modules/neo-async/async.js:3624:14)
    at PoolWorker.onWorkerMessage (/app/core/frontend/node_modules/thread-loader/dist/WorkerPool.js:170:35)
    at validate (/app/core/frontend/node_modules/file-replace-loader/node_modules/schema-utils/dist/validate.js:98:11)
    at Object._default (/app/core/frontend/node_modules/file-replace-loader/dist/index.js:164:30)

It works when using the vue-cli-service serve command.

Webpack chain is used for building the webpack configuration. The vue inspect command returns the following configuration for the file-replace-loader:

{
  enforce: 'pre',
  test: /\.*$/,
  use: [
    {
      loader: 'file-replace-loader',
      options: {
        condition: 'always',
        replacement: function () { /* omitted long function */ },
        async: false
      }
    }
  ]
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions