arackaf / customize-cra

Override webpack configurations for create-react-app 2.0

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

tap({ dest: 'customize-cra.log' }). throw new ERR_INVALID_CALLBACK(cb);

tomatobybike opened this issue · comments

``

addPostcssPlugins([
    require('postcss-px-to-viewport')({
      ...
    })
  ]),
  addWebpackModuleRule(
    {
      test: /\.less$/,
      use: ['style-loader', 'css-loader', 'less-loader', {
        loader: 'style-resources-loader',
        options: {
            patterns: [
                './src/global/*.less'
            ]
        }
      }]
    }
  ),

``

yarn run build

then throw error:

fs.js:160
  throw new ERR_INVALID_CALLBACK(cb);
  ^

TypeError [ERR_INVALID_CALLBACK]: Callback must be a function. Received undefined

same here, with "customize-cra": "1.0.0" and tap({ dest: 'customize-cra.log' }), I got

fs.js:160
  throw new ERR_INVALID_CALLBACK(cb);
  ^

TypeError [ERR_INVALID_CALLBACK]: Callback must be a function. Received undefined
    at maybeCallback (fs.js:160:9)
    at Object.appendFile (fs.js:1483:14)
    at Object.<anonymous> (/home/path/furnish/node_modules/customize-cra/dist/index.cjs.js:1:1166)
    at Object.webpack (/home/path/furnish/node_modules/lodash.flow/index.js:177:42)
    at /home/path/furnish/node_modules/react-app-rewired/scripts/build.js:26:24
    at Object.<anonymous> (/home/path/furnish/node_modules/react-scripts/scripts/build.js:67:16)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at Function.Module._load (internal/modules/cjs/loader.js:769:14) {
  code: 'ERR_INVALID_CALLBACK'
}

as a workaround :
tap({ message: 'Pre - Customizers' }) + yarn build > customize-cra.log

utilities.js
line 45
if (dest) { const fs = require('fs') fs.appendFile(dest,${print.join('\n')}\n) }
shoud change to

if (dest) { const fs = require('fs') fs.appendFile(dest,${print.join('\n')}\n`,()=>{})
}

`

fs.appendFile function node Version > 16 need callback function