BaristaLabs / craco-raw-loader

A raw-loader plugin for craco / react-scripts / create-react-app
MIT License
0 stars 1 forks source link

Can't start craco - cannot read 'push' from undefined error #24

Open sigmasoldi3r opened 2 years ago

sigmasoldi3r commented 2 years ago

Hello! I was giving a try to this plugin, but I can't figure out how to make it run, here is the error:

C:\my-project>yarn start
yarn run v1.21.1
$ craco start
(node:11068) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'push' of undefined
    at Object.overrideWebpackConfig (C:\my-project\node_modules\@baristalabs\craco-raw-loader\lib\craco-raw-loader.js:47:36)
    at overrideWebpack (C:\my-project\node_modules\@craco\craco\lib\features\plugins.js:42:40)
    at C:\my-project\node_modules\@craco\craco\lib\features\plugins.js:64:29
    at Array.forEach (<anonymous>)
    at applyWebpackConfigPlugins (C:\my-project\node_modules\@craco\craco\lib\features\plugins.js:63:29)
    at mergeWebpackConfig (C:\my-project\node_modules\@craco\craco\lib\features\webpack\merge-webpack-config.js:110:30)
    at overrideWebpackDev (C:\my-project\node_modules\@craco\craco\lib\features\webpack\override.js:11:36)
    at C:\my-project\node_modules\@craco\craco\scripts\start.js:27:5
(Use `node --trace-warnings ...` to show where the warning was created)
(node:11068) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, 
or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:11068) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Done in 9.77s.

My .cracorc.ts configuration file looks like the following:

import { CracoConfig } from '@craco/craco'
const CracoRawLoaderPlugin = require('@baristalabs/craco-raw-loader')

export default {
  plugins: [
    {
      plugin: CracoRawLoaderPlugin,
      options: {
        test: /\.txt$/,
      },
    },
  ],
} as CracoConfig

(Also tried importing the plugin with import either as namespace or default, but without sucess)

Node version v14.17.0

Time-year commented 2 years ago

Hello, is there a solution to this problem? I met the same problem when I tried the plug-in