React-App-Rewired (compiling) "Icons" is not defined (cache issue) - Stack Overflow

I've compiled versions of this code many times over the past few years.It also runs fine in develop

  • I've compiled versions of this code many times over the past few years.

  • It also runs fine in development mode, it just won't compile to staging (or production).

  • VS Code isn't reporting any errors or warnings

The word "Icons" (case-sensitive) is not anywhere in my code-base. I did name an object that, but I renamed it to SiteIcons. It was telling me that Icons was undefined, when it clearly shouldn't have been.

But when I run react-app-rewired build --config-overrides=./config-overrides.js, (file and command are unchanged from last several compiles), I get dozens of errors throughout the project like this,

Line 115:42:  'Icons' is not defined  react/jsx-no-undef

and some other calls to Material Icons that I've now moved to this object

Line 298:141:  'ReceiptLongRounded' is not defined  react/jsx-no-undef
Line 330:52:   'PasswordRounded' is not defined    react/jsx-no-undef

But when i follow to a linked file to any of these reports

src\views\_widgets\short-form.tsx
  Line 194:56:  'ErrorTwoTone' is not defined  react/jsx-no-undef

I see that the code at that line actually says, as it's supposed to

<SiteIcons.ErrorTwoTone />

I've tried clearing the npm cache, the babel cache, and restarting the machine

  • I've compiled versions of this code many times over the past few years.

  • It also runs fine in development mode, it just won't compile to staging (or production).

  • VS Code isn't reporting any errors or warnings

The word "Icons" (case-sensitive) is not anywhere in my code-base. I did name an object that, but I renamed it to SiteIcons. It was telling me that Icons was undefined, when it clearly shouldn't have been.

But when I run react-app-rewired build --config-overrides=./config-overrides.js, (file and command are unchanged from last several compiles), I get dozens of errors throughout the project like this,

Line 115:42:  'Icons' is not defined  react/jsx-no-undef

and some other calls to Material Icons that I've now moved to this object

Line 298:141:  'ReceiptLongRounded' is not defined  react/jsx-no-undef
Line 330:52:   'PasswordRounded' is not defined    react/jsx-no-undef

But when i follow to a linked file to any of these reports

src\views\_widgets\short-form.tsx
  Line 194:56:  'ErrorTwoTone' is not defined  react/jsx-no-undef

I see that the code at that line actually says, as it's supposed to

<SiteIcons.ErrorTwoTone />

I've tried clearing the npm cache, the babel cache, and restarting the machine

Share Improve this question asked Mar 13 at 21:18 Regular JoRegular Jo 5,5003 gold badges26 silver badges53 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

I was able to solve this weird cache issue by effectively touching each file.

Honestly, I just ran a project-wide replace of ^import SiteIcons with $0 in VSCode.

After this, the project compiled fine, no more mysterious undef issues.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744684972a4587858.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信
['keyword'] : $thread['subject']; $header['description'] = $thread['description'] ? $thread['description'] : $thread['brief']; $_SESSION['fid'] = $fid; if ($ajax) { empty($conf['api_on']) and message(0, lang('closed')); $apilist['header'] = $header; $apilist['extra'] = $extra; $apilist['access'] = $access; $apilist['thread'] = well_thread_safe_info($thread); $apilist['thread_data'] = $data; $apilist['forum'] = $forum; $apilist['imagelist'] = $imagelist; $apilist['filelist'] = $thread['filelist']; $apilist['threadlist'] = $threadlist; message(0, $apilist); } else { include _include(theme_load('single_page', $fid)); } break; default: message(-1, lang('data_malformation')); break; } ?>