Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor whole codebase #75

Merged
merged 20 commits into from May 21, 2020
Merged

Refactor whole codebase #75

merged 20 commits into from May 21, 2020

Conversation

cmmartti
Copy link
Member

@cmmartti cmmartti commented Apr 23, 2020

This is a messy PR, but it's basically the result of me messing around with the code and trying to fix everything all at once. Preview at https://musing-mcclintock-d866d7.netlify.app/

A quick summary below:

  • Switch to React-Static from Gatsby:

    Gatsby forces you to use GraphQL for pre-processing data, and is generally inflexible. There's an overview here that covers the main reasons why I prefer React-Static, but it basically boils down to: I didn't want to deal with GraphQL and custom plugins to pre-process the documentation data so the docs page doesn't need to ship >4 MB of JS, including a Markdown parser, two copies of the data in HTML and JSON, doesn't need to parse that JSON multiple times between search-and-replacing the domain name, etc.

  • Add alert notice about missing Sword+Shield data:

    Note: Data from last year's Sword and Shield games (generation 8) is not yet included in PokéAPI. We rely on an upstream project (Veekun) for data and they have not yet been able to complete the update due to lack of developer support. When the new data is available, we will import it into the API.
    Read more on GitHub…

  • Refactor everything:

    This commit touches almost every file in the codebase. There should be a lot of speed improvements, especially on the Documentation page. A lot less code is being shipped to the browser, and the random bugs on the Documentation table of contents should be gone. Visually, it's almost identical to the previous version.

Gatsby forces you to use GraphQL for pre-processing data, and is
generally inflexible. There's an overview here:
https://medium.com/@tannerlinsley/%EF%B8%8F-introducing-react-static-a-progressive-static-site-framework-for-react-3470d2a51ebc
that covers the main reasons why I prefer React-Static, but it basically
boils down to: I didn't want to deal with GraphQL and custom plugins to
pre-process the documentation data so the docs page doesn't need to ship
>4 MB of JS, including a Markdown parser, two copies of the data
(in HTML and JSON), doesn't need to parse that JSON multiple times between
search-and-replacing the domain name, etc.

This commit only deals with moving to React-Static; the docs page is
still dog-slow, but the next commits will improve it considerably.
Future versions have a bug that prevents building the static site on
Windows. React-Static v8 fixes the issue, but is not publicly available
yet.
react-static/react-static#1360
This commit touches almost every file in the codebase.
There should be a lot of speed improvements, especially on the
Documentation page.
A lot less code is being shipped to the browser,
and the random bugs on the Documentation table of contents should be gone.
Visually, it's almost identical to the previous version.
@Naramsim
Copy link
Member

Thanks, @cmmartti! Tomorrow I'll take a look at the code to see all the improvements! I just checked the demo on Netlify and it seems to work flawlessly

@Naramsim Naramsim self-requested a review April 23, 2020 19:45
@cmmartti
Copy link
Member Author

I just noticed that I forgot to add Google Analytics back in. Is this something we use at all?

@Naramsim
Copy link
Member

Yes, we need it. It should be the UA: UA-53299289-1

@Naramsim
Copy link
Member

In the package.json you can update the repository.url field.

@Naramsim
Copy link
Member

We need also to instruct CircleCI to use the files in the dist folder and not any longer the ones in the public one.

@Naramsim
Copy link
Member

Naramsim commented Apr 27, 2020

@cmmartti, I cannot build the project. I'm running on Node 12 on Win10.

  Error: Trace: SyntaxError: C:\Users\Ale\Documents\GitHub\pokeapi.co\static.config.js: Support for the experimental syntax 'nullishCoalescingOperator' isn't currently enabled (48:40):

    46 |                 .map(alert => ({
    47 |                     htmlMessage: marked(alert.message),
  > 48 |                     level: alert.level ?? 'info',
       |                                        ^
    49 |                     id: hashSum(alert),
    50 |                 })),
    51 |         };

@Naramsim
Copy link
Member

@cmmartti
Copy link
Member Author

cmmartti commented Apr 27, 2020

That's because static.config.js isn't processed by Babel, et al. It only runs at build time as is. Weirdly, I have v13.12 of Node, and support for the nullish coalescing operator was only just added in v14, but it still runs fine on my machine.

The solution is to remove that use of ??, which I will do.

@Naramsim
Copy link
Member

There are also other ??

https://github.com/cmmartti/pokeapi.co/blob/master/src/utils/useActiveAnchor.js#L34
also in BreadCrumbs.js and JsonViewer.js

@Naramsim
Copy link
Member

I also had to run npm install --save-dev file-loader

@Naramsim
Copy link
Member

Naramsim commented Apr 28, 2020

In the <head> there is no favicon.

Maybe you can add one. I don't know if it's better to do it in App.js or use a plugin.

@Naramsim
Copy link
Member

Naramsim commented Apr 28, 2020

It would be nice also to have a manifest (even though the website is not a PWA) and set the properties name background_color icons theme_color. So the docs will look fancier on mobile.

@Naramsim
Copy link
Member

Other than that it works pretty well 😃

@cmmartti
Copy link
Member Author

Code that is not in static.config.js is transpiled, so usage of ?? in those places is fine.

The favicon and manifest are added at build-time only, so you won't see them in dev mode.

Can you elaborate on why you needed to add that package? I don't recall using it in the code. Maybe a dependency uses it, but npm should have installed it.

@Naramsim
Copy link
Member

Hi @cmmartti, below you find the whole log that was generated by npm run build.

It seems that the ?? is not allowed.

C:\Users\Ale\Documents\GitHub\pokeapi.co [cmmartti/master]> npm run build

> pokeapi.co@ build C:\Users\Ale\Documents\GitHub\pokeapi.co
> react-static build

Bundling application for Production...

Browserslist: caniuse-lite is outdated. Please run next command `npm update`
Cleaning dist...
[✓] Dist cleaned
Cleaning artifacts...
[✓] Artifacts cleaned
Building Routes...
[✓] Routes Built
Building Templates...
[✓] Templates Built
Copying public directory...
[✓] Public directory copied (1s)
Bundling App...

  Replace Autoprefixer browsers option to Browserslist config.
  Use browserslist key in package.json or .browserslistrc file.

  Using browsers option can cause errors. Browserslist config
  can be used for Babel, Autoprefixer, postcss-normalize and other tools.

  If you really need to use option, rename it to overrideBrowserslist.

  Learn more at:
  https://github.com/browserslist/browserslist#readme
  https://twitter.com/browserslist


Browserslist: caniuse-lite is outdated. Please run next command `npm update`
Browserslist: caniuse-lite is outdated. Please run next command `npm update`
Browserslist: caniuse-lite is outdated. Please run next command `npm update`
Browserslist: caniuse-lite is outdated. Please run next command `npm update`
Browserslist: caniuse-lite is outdated. Please run next command `npm update`
Browserslist: caniuse-lite is outdated. Please run next command `npm update`
Version: webpack 4.41.2
Time: 9733ms
Built at: 04/29/2020 11:55:18 AM
                                  Asset      Size  Chunks               Chunk Names
                       main.ac76e76e.js  13.1 KiB       1  [immutable]  main
                    styles.ea7d42da.css  14.4 KiB       0  [immutable]  styles
    templates/src/pages/404.3d1dfdad.js  1.22 KiB       2  [immutable]  src/pages/404
  templates/src/pages/about.69bf3ebc.js  8.86 KiB       3  [immutable]  src/pages/about
   templates/src/pages/docs.6fc12564.js  1.15 KiB       4  [immutable]  src/pages/docs
templates/src/pages/docs/v1.672a23b1.js   2.3 KiB       5  [immutable]  src/pages/docs/v1
templates/src/pages/docs/v2.66bd4a6a.js  25.7 KiB       6  [immutable]  src/pages/docs/v2
  templates/src/pages/index.fa6e1dd8.js  14.7 KiB       7  [immutable]  src/pages/index
 templates/src/pages/status.897137e3.js  1.33 KiB       8  [immutable]  src/pages/status
           templates/styles.ea7d42da.js  2.83 KiB       0  [immutable]  styles
     templates/vendors~main.4c6dab67.js   250 KiB       9  [immutable]  vendors~main
  [0] C:/Users/Ale/Documents/GitHub/pokeapi.co/node_modules/react/index.js 189 bytes {9} [built]
  [3] C:/Users/Ale/Documents/GitHub/pokeapi.co/node_modules/@babel/runtime/helpers/interopRequireDefault.js 147 bytes {9} [built]
 [15] ../lib/browser/index.js 24.9 KiB {9} [built]
 [20] (webpack)/buildin/module.js 552 bytes {9} [built]
 [21] C:/Users/Ale/Documents/GitHub/pokeapi.co/node_modules/@babel/runtime/helpers/extends.js 427 bytes {9} [built]
 [26] ../lib/browser/hooks/useStaticInfo.js 624 bytes {9} [built]
 [41] C:/Users/Ale/Documents/GitHub/pokeapi.co/artifacts/react-static-browser-plugins.js 581 bytes {1} [built]
 [55] C:/Users/Ale/Documents/GitHub/pokeapi.co/node_modules/@babel/runtime/helpers/interopRequireWildcard.js 1.15 KiB {9} [built]
 [59] C:/Users/Ale/Documents/GitHub/pokeapi.co/artifacts/react-static-templates.js 4.83 KiB {1} [built]
 [66] C:/Users/Ale/Documents/GitHub/pokeapi.co/node_modules/@babel/runtime/helpers/objectWithoutProperties.js 665 bytes {9} [built]
 [74] multi ../lib/bootstrapPlugins.js ../lib/bootstrapTemplates.js ../lib/bootstrapApp.js 52 bytes {1} [built]
 [75] ../lib/bootstrapPlugins.js 472 bytes {9} [built]
[130] ../lib/bootstrapTemplates.js 722 bytes {9} [built]
[136] ../lib/bootstrapApp.js 1.48 KiB {9} [built]
[138] C:/Users/Ale/Documents/GitHub/pokeapi.co/src/index.js 626 bytes {1} [built]
    + 160 hidden modules

ERROR in C:/Users/Ale/Documents/GitHub/pokeapi.co/src/components/BreadCrumbs/BreadCrumbs.js
Module build failed (from C:/Users/Ale/Documents/GitHub/pokeapi.co/node_modules/babel-loader/lib/index.js):
SyntaxError: C:\Users\Ale\Documents\GitHub\pokeapi.co\src\components\BreadCrumbs\BreadCrumbs.js: Support for the experimental syntax 'nullishCoalescingOperator' isn't currently enabled (10:59):

   8 |     const activeEntryId = useActiveAnchor(entries.map(e => e.id));
   9 |     const activeEntry =
> 10 |         entries.find(entry => entry.id === activeEntryId) ?? entries[0];
     |                                                           ^
  11 |
  12 |     return (
  13 |         <React.Fragment>

Add @babel/plugin-proposal-nullish-coalescing-operator (https://git.io/vb4Se) to the 'plugins' section of your Babel config to enable transformation.
    at Object.raise (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\location.js:41:63)
    at Object.expectPlugin (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\util.js:165:18)
    at Object.parseExprOp (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\expression.js:358:16)
    at Object.parseExprOps (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\expression.js:313:17)
    at Object.parseMaybeConditional (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\expression.js:256:23)
    at Object.parseMaybeAssign (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\expression.js:186:21)
    at Object.parseVar (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\statement.js:985:26)
    at Object.parseVarStatement (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\statement.js:697:10)
    at Object.parseStatementContent (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\statement.js:211:21)
    at Object.parseStatement (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\statement.js:141:17)
    at Object.parseBlockOrModuleBlockBody (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\statement.js:860:25)
    at Object.parseBlockBody (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\statement.js:836:10)
    at Object.parseBlock (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\statement.js:813:10)
    at Object.parseFunctionBody (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\expression.js:1996:24)
    at Object.parseFunctionBodyAndFinish (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\expression.js:1941:10)
    at callback (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\statement.js:1071:12)
    at Object.withTopicForbiddingContext (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\expression.js:2485:14)
    at Object.parseFunction (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\statement.js:1069:10)
    at Object.parseExportDefaultExpression (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\statement.js:1781:19)
    at Object.parseExport (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\statement.js:1682:31)
    at Object.parseStatementContent (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\statement.js:251:25)
    at Object.parseStatement (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\statement.js:141:17)
    at Object.parseBlockOrModuleBlockBody (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\statement.js:860:25)
    at Object.parseBlockBody (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\statement.js:836:10)
    at Object.parseTopLevel (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\statement.js:47:10)
    at Object.parse (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\index.js:43:10)
    at parse (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\index.js:58:38)
    at parser (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\core\lib\transformation\normalize-file.js:168:34)
    at normalizeFile (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\core\lib\transformation\normalize-file.js:102:11)
    at runSync (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\core\lib\transformation\index.js:44:43)
    at runAsync (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\core\lib\transformation\index.js:35:14)
    at C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\core\lib\transform.js:34:34
    at processTicksAndRejections (internal/process/task_queues.js:79:11)
 @ C:/Users/Ale/Documents/GitHub/pokeapi.co/src/components/BreadCrumbs/index.js 1:0-35 1:0-35
 @ C:/Users/Ale/Documents/GitHub/pokeapi.co/src/components/DocsContainer/DocsContainer.js
 @ C:/Users/Ale/Documents/GitHub/pokeapi.co/src/components/DocsContainer/index.js
 @ C:/Users/Ale/Documents/GitHub/pokeapi.co/src/pages/docs/v2.js
 @ C:/Users/Ale/Documents/GitHub/pokeapi.co/artifacts/react-static-templates.js
 @ ../lib/bootstrapTemplates.js
 @ multi ../lib/bootstrapPlugins.js ../lib/bootstrapTemplates.js ../lib/bootstrapApp.js

ERROR in C:/Users/Ale/Documents/GitHub/pokeapi.co/src/components/JsonViewer/JsonViewer.js
Module build failed (from C:/Users/Ale/Documents/GitHub/pokeapi.co/node_modules/babel-loader/lib/index.js):
SyntaxError: C:\Users\Ale\Documents\GitHub\pokeapi.co\src\components\JsonViewer\JsonViewer.js: Support for the experimental syntax 'nullishCoalescingOperator' isn't currently enabled (37:54):

  35 |     }, []);
  36 |
> 37 |     const jsonString = JSON.stringify(data, null, 2) ?? '';
     |                                                      ^
  38 |     const jsonSize = new TextEncoder('utf-8').encode(jsonString).length / 1000; // kB
  39 |     const jsonLines = (jsonString.match(/\r?\n/g) || '').length + 1;
  40 |

Add @babel/plugin-proposal-nullish-coalescing-operator (https://git.io/vb4Se) to the 'plugins' section of your Babel config to enable transformation.
    at Object.raise (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\location.js:41:63)
    at Object.expectPlugin (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\util.js:165:18)
    at Object.parseExprOp (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\expression.js:358:16)
    at Object.parseExprOps (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\expression.js:313:17)
    at Object.parseMaybeConditional (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\expression.js:256:23)
    at Object.parseMaybeAssign (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\expression.js:186:21)
    at Object.parseVar (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\statement.js:985:26)
    at Object.parseVarStatement (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\statement.js:697:10)
    at Object.parseStatementContent (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\statement.js:211:21)
    at Object.parseStatement (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\statement.js:141:17)
    at Object.parseBlockOrModuleBlockBody (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\statement.js:860:25)
    at Object.parseBlockBody (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\statement.js:836:10)
    at Object.parseBlock (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\statement.js:813:10)
    at Object.parseFunctionBody (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\expression.js:1996:24)
    at Object.parseFunctionBodyAndFinish (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\expression.js:1941:10)
    at callback (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\statement.js:1071:12)
    at Object.withTopicForbiddingContext (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\expression.js:2485:14)
    at Object.parseFunction (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\statement.js:1069:10)
    at Object.parseExportDefaultExpression (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\statement.js:1781:19)
    at Object.parseExport (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\statement.js:1682:31)
    at Object.parseStatementContent (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\statement.js:251:25)
    at Object.parseStatement (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\statement.js:141:17)
    at Object.parseBlockOrModuleBlockBody (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\statement.js:860:25)
    at Object.parseBlockBody (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\statement.js:836:10)
    at Object.parseTopLevel (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\statement.js:47:10)
    at Object.parse (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\index.js:43:10)
    at parse (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\index.js:58:38)
    at parser (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\core\lib\transformation\normalize-file.js:168:34)
    at normalizeFile (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\core\lib\transformation\normalize-file.js:102:11)
    at runSync (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\core\lib\transformation\index.js:44:43)
    at runAsync (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\core\lib\transformation\index.js:35:14)
    at C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\core\lib\transform.js:34:34
    at processTicksAndRejections (internal/process/task_queues.js:79:11)
 @ C:/Users/Ale/Documents/GitHub/pokeapi.co/src/components/JsonViewer/index.js 1:0-34 1:0-34
 @ C:/Users/Ale/Documents/GitHub/pokeapi.co/src/pages/docs/v2.js
 @ C:/Users/Ale/Documents/GitHub/pokeapi.co/artifacts/react-static-templates.js
 @ ../lib/bootstrapTemplates.js
 @ multi ../lib/bootstrapPlugins.js ../lib/bootstrapTemplates.js ../lib/bootstrapApp.js

ERROR in C:/Users/Ale/Documents/GitHub/pokeapi.co/src/utils/useActiveAnchor.js
Module build failed (from C:/Users/Ale/Documents/GitHub/pokeapi.co/node_modules/babel-loader/lib/index.js):
SyntaxError: C:\Users\Ale\Documents\GitHub\pokeapi.co\src\utils\useActiveAnchor.js: Support for the experimental syntax 'nullishCoalescingOperator' isn't currently enabled (34:19):

  32 |     }, [ids]);
  33 |
> 34 |     return active ?? ids[0];
     |                   ^
  35 | }
  36 |

Add @babel/plugin-proposal-nullish-coalescing-operator (https://git.io/vb4Se) to the 'plugins' section of your Babel config to enable transformation.
    at Object.raise (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\location.js:41:63)
    at Object.expectPlugin (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\util.js:165:18)
    at Object.parseExprOp (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\expression.js:358:16)
    at Object.parseExprOps (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\expression.js:313:17)
    at Object.parseMaybeConditional (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\expression.js:256:23)
    at Object.parseMaybeAssign (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\expression.js:186:21)
    at Object.parseExpression (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\expression.js:134:23)
    at Object.parseReturnStatement (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\statement.js:584:28)
    at Object.parseStatementContent (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\statement.js:194:21)
    at Object.parseStatement (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\statement.js:141:17)
    at Object.parseBlockOrModuleBlockBody (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\statement.js:860:25)
    at Object.parseBlockBody (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\statement.js:836:10)
    at Object.parseBlock (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\statement.js:813:10)
    at Object.parseFunctionBody (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\expression.js:1996:24)
    at Object.parseFunctionBodyAndFinish (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\expression.js:1941:10)
    at callback (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\statement.js:1071:12)
    at Object.withTopicForbiddingContext (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\expression.js:2485:14)
    at Object.parseFunction (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\statement.js:1069:10)
    at Object.parseExportDefaultExpression (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\statement.js:1781:19)
    at Object.parseExport (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\statement.js:1682:31)
    at Object.parseStatementContent (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\statement.js:251:25)
    at Object.parseStatement (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\statement.js:141:17)
    at Object.parseBlockOrModuleBlockBody (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\statement.js:860:25)
    at Object.parseBlockBody (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\statement.js:836:10)
    at Object.parseTopLevel (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\statement.js:47:10)
    at Object.parse (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\index.js:43:10)
    at parse (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\index.js:58:38)
    at parser (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\core\lib\transformation\normalize-file.js:168:34)
    at normalizeFile (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\core\lib\transformation\normalize-file.js:102:11)
    at runSync (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\core\lib\transformation\index.js:44:43)
    at runAsync (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\core\lib\transformation\index.js:35:14)
    at C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\core\lib\transform.js:34:34
    at processTicksAndRejections (internal/process/task_queues.js:79:11)
 @ C:/Users/Ale/Documents/GitHub/pokeapi.co/src/components/TableOfContents/TableOfContents.js 1:180-237 1:393-408
 @ C:/Users/Ale/Documents/GitHub/pokeapi.co/src/components/TableOfContents/index.js
 @ C:/Users/Ale/Documents/GitHub/pokeapi.co/src/components/DocsContainer/DocsContainer.js
 @ C:/Users/Ale/Documents/GitHub/pokeapi.co/src/components/DocsContainer/index.js
 @ C:/Users/Ale/Documents/GitHub/pokeapi.co/src/pages/docs/v2.js
 @ C:/Users/Ale/Documents/GitHub/pokeapi.co/artifacts/react-static-templates.js
 @ ../lib/bootstrapTemplates.js
 @ multi ../lib/bootstrapPlugins.js ../lib/bootstrapTemplates.js ../lib/bootstrapApp.js

ERROR in C:/Users/Ale/Documents/GitHub/pokeapi.co/src/images/pokeapi_256.png
Module build failed (from C:/Users/Ale/Documents/GitHub/pokeapi.co/node_modules/url-loader/dist/cjs.js):
Error: Cannot find module 'file-loader'
Require stack:
- C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\url-loader\dist\index.js
- C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\url-loader\dist\cjs.js
- C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\loader-runner\lib\loadLoader.js
- C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\loader-runner\lib\LoaderRunner.js
- C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\webpack\lib\NormalModule.js
- C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\webpack\lib\NormalModuleFactory.js
- C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\webpack\lib\Compiler.js
- C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\webpack\lib\webpack.js
- C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\react-static\lib\static\webpack\buildProductionBundles.js
- C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\react-static\lib\commands\bundle.js
- C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\react-static\lib\commands\build.js
- C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\react-static\bin\react-static
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:982:15)
    at Function.Module._load (internal/modules/cjs/loader.js:864:27)
    at Module.call (internal/modules/cjs/loader.js:1044:19)
    at Module.require (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\react-static\src\utils\binHelper.js:62:26)
    at require (internal/modules/cjs/helpers.js:77:18)
    at Object.loader (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\url-loader\dist\index.js:68:20)
 @ C:/Users/Ale/Documents/GitHub/pokeapi.co/src/App.js 1:232-275 1:1206-1210
 @ C:/Users/Ale/Documents/GitHub/pokeapi.co/src/index.js
 @ ../lib/bootstrapApp.js
 @ multi ../lib/bootstrapPlugins.js ../lib/bootstrapTemplates.js ../lib/bootstrapApp.js
Child extract-css-chunks-webpack-plugin css-loader/dist/cjs.js??ref--4-oneOf-0-1!postcss-loader/src/index.js??postcss!../../sass-loader/dist/cjs.js??ref--4-oneOf-0-3!../../../src/components/Alert/Alert.module.scss:
    [0] ./css-loader/dist/cjs.js??ref--4-oneOf-0-1!./postcss-loader/src??postcss!C:/Users/Ale/Documents/GitHub/pokeapi.co/node_modules/sass-loader/dist/cjs.js??ref--4-oneOf-0-3!C:/Users/Ale/Documents/GitHub/pokeapi.co/src/components/Alert/Alert.module.scss 3.03 KiB {0} [built]
    [1] ./css-loader/dist/runtime/api.js 2.35 KiB {0} [built]
Child extract-css-chunks-webpack-plugin css-loader/dist/cjs.js??ref--4-oneOf-0-1!postcss-loader/src/index.js??postcss!../../sass-loader/dist/cjs.js??ref--4-oneOf-0-3!../../../src/components/ApiExplorer/ApiExplorer.module.scss:
    [0] ./css-loader/dist/cjs.js??ref--4-oneOf-0-1!./postcss-loader/src??postcss!C:/Users/Ale/Documents/GitHub/pokeapi.co/node_modules/sass-loader/dist/cjs.js??ref--4-oneOf-0-3!C:/Users/Ale/Documents/GitHub/pokeapi.co/src/components/ApiExplorer/ApiExplorer.module.scss 815 bytes {0} [built]
    [1] ./css-loader/dist/runtime/api.js 2.35 KiB {0} [built]
Child extract-css-chunks-webpack-plugin css-loader/dist/cjs.js??ref--4-oneOf-0-1!postcss-loader/src/index.js??postcss!../../sass-loader/dist/cjs.js??ref--4-oneOf-0-3!../../../src/components/ApiExplorer/Input.module.scss:
    [0] ./css-loader/dist/cjs.js??ref--4-oneOf-0-1!./postcss-loader/src??postcss!C:/Users/Ale/Documents/GitHub/pokeapi.co/node_modules/sass-loader/dist/cjs.js??ref--4-oneOf-0-3!C:/Users/Ale/Documents/GitHub/pokeapi.co/src/components/ApiExplorer/Input.module.scss 1.29 KiB {0} [built]
    [1] ./css-loader/dist/runtime/api.js 2.35 KiB {0} [built]
Child extract-css-chunks-webpack-plugin css-loader/dist/cjs.js??ref--4-oneOf-0-1!postcss-loader/src/index.js??postcss!../../sass-loader/dist/cjs.js??ref--4-oneOf-0-3!../../../src/components/DocsContainer/DocsContainer.module.scss:
    [0] ./css-loader/dist/cjs.js??ref--4-oneOf-0-1!./postcss-loader/src??postcss!C:/Users/Ale/Documents/GitHub/pokeapi.co/node_modules/sass-loader/dist/cjs.js??ref--4-oneOf-0-3!C:/Users/Ale/Documents/GitHub/pokeapi.co/src/components/DocsContainer/DocsContainer.module.scss 1.83 KiB {0} [built]
    [1] ./css-loader/dist/runtime/api.js 2.35 KiB {0} [built]
Child extract-css-chunks-webpack-plugin css-loader/dist/cjs.js??ref--4-oneOf-0-1!postcss-loader/src/index.js??postcss!../../sass-loader/dist/cjs.js??ref--4-oneOf-0-3!../../../src/components/Footer/Footer.module.scss:
    [0] ./css-loader/dist/cjs.js??ref--4-oneOf-0-1!./postcss-loader/src??postcss!C:/Users/Ale/Documents/GitHub/pokeapi.co/node_modules/sass-loader/dist/cjs.js??ref--4-oneOf-0-3!C:/Users/Ale/Documents/GitHub/pokeapi.co/src/components/Footer/Footer.module.scss 510 bytes {0} [built]
    [1] ./css-loader/dist/runtime/api.js 2.35 KiB {0} [built]
Child extract-css-chunks-webpack-plugin css-loader/dist/cjs.js??ref--4-oneOf-0-1!postcss-loader/src/index.js??postcss!../../sass-loader/dist/cjs.js??ref--4-oneOf-0-3!../../../src/components/Header/Header.module.scss:
    [0] ./css-loader/dist/cjs.js??ref--4-oneOf-0-1!./postcss-loader/src??postcss!C:/Users/Ale/Documents/GitHub/pokeapi.co/node_modules/sass-loader/dist/cjs.js??ref--4-oneOf-0-3!C:/Users/Ale/Documents/GitHub/pokeapi.co/src/components/Header/Header.module.scss 2.38 KiB {0} [built]
    [1] ./css-loader/dist/runtime/api.js 2.35 KiB {0} [built]
Child extract-css-chunks-webpack-plugin css-loader/dist/cjs.js??ref--4-oneOf-0-1!postcss-loader/src/index.js??postcss!../../sass-loader/dist/cjs.js??ref--4-oneOf-0-3!../../../src/components/LinkButton/LinkButton.module.scss:
    [0] ./css-loader/dist/cjs.js??ref--4-oneOf-0-1!./postcss-loader/src??postcss!C:/Users/Ale/Documents/GitHub/pokeapi.co/node_modules/sass-loader/dist/cjs.js??ref--4-oneOf-0-3!C:/Users/Ale/Documents/GitHub/pokeapi.co/src/components/LinkButton/LinkButton.module.scss 857 bytes {0} [built]
    [1] ./css-loader/dist/runtime/api.js 2.35 KiB {0} [built]
Child extract-css-chunks-webpack-plugin css-loader/dist/cjs.js??ref--4-oneOf-0-1!postcss-loader/src/index.js??postcss!../../sass-loader/dist/cjs.js??ref--4-oneOf-0-3!../../../src/components/Page/Page.module.scss:
    [0] ./css-loader/dist/cjs.js??ref--4-oneOf-0-1!./postcss-loader/src??postcss!C:/Users/Ale/Documents/GitHub/pokeapi.co/node_modules/sass-loader/dist/cjs.js??ref--4-oneOf-0-3!C:/Users/Ale/Documents/GitHub/pokeapi.co/src/components/Page/Page.module.scss 665 bytes {0} [built]
    [1] ./css-loader/dist/runtime/api.js 2.35 KiB {0} [built]
Child extract-css-chunks-webpack-plugin css-loader/dist/cjs.js??ref--4-oneOf-0-1!postcss-loader/src/index.js??postcss!../../sass-loader/dist/cjs.js??ref--4-oneOf-0-3!../../../src/components/TableOfContents/TableOfContents.module.scss:
    [0] ./css-loader/dist/cjs.js??ref--4-oneOf-0-1!./postcss-loader/src??postcss!C:/Users/Ale/Documents/GitHub/pokeapi.co/node_modules/sass-loader/dist/cjs.js??ref--4-oneOf-0-3!C:/Users/Ale/Documents/GitHub/pokeapi.co/src/components/TableOfContents/TableOfContents.module.scss 964 bytes {0} [built]
    [1] ./css-loader/dist/runtime/api.js 2.35 KiB {0} [built]
Child extract-css-chunks-webpack-plugin css-loader/dist/cjs.js??ref--4-oneOf-0-1!postcss-loader/src/index.js??postcss!../../sass-loader/dist/cjs.js??ref--4-oneOf-0-3!../../../src/pages/about.module.scss:
    [0] ./css-loader/dist/cjs.js??ref--4-oneOf-0-1!./postcss-loader/src??postcss!C:/Users/Ale/Documents/GitHub/pokeapi.co/node_modules/sass-loader/dist/cjs.js??ref--4-oneOf-0-3!C:/Users/Ale/Documents/GitHub/pokeapi.co/src/pages/about.module.scss 651 bytes {0} [built]
    [1] ./css-loader/dist/runtime/api.js 2.35 KiB {0} [built]
Child extract-css-chunks-webpack-plugin css-loader/dist/cjs.js??ref--4-oneOf-0-1!postcss-loader/src/index.js??postcss!../../sass-loader/dist/cjs.js??ref--4-oneOf-0-3!../../../src/pages/docs/v2.module.scss:
    [0] ./css-loader/dist/cjs.js??ref--4-oneOf-0-1!./postcss-loader/src??postcss!C:/Users/Ale/Documents/GitHub/pokeapi.co/node_modules/sass-loader/dist/cjs.js??ref--4-oneOf-0-3!C:/Users/Ale/Documents/GitHub/pokeapi.co/src/pages/docs/v2.module.scss 1.17 KiB {0} [built]
    [1] ./css-loader/dist/runtime/api.js 2.35 KiB {0} [built]
Child extract-css-chunks-webpack-plugin css-loader/dist/cjs.js??ref--4-oneOf-0-1!postcss-loader/src/index.js??postcss!../../sass-loader/dist/cjs.js??ref--4-oneOf-0-3!../../../src/pages/index.module.scss:
    [0] ./css-loader/dist/cjs.js??ref--4-oneOf-0-1!./postcss-loader/src??postcss!C:/Users/Ale/Documents/GitHub/pokeapi.co/node_modules/sass-loader/dist/cjs.js??ref--4-oneOf-0-3!C:/Users/Ale/Documents/GitHub/pokeapi.co/src/pages/index.module.scss 2.29 KiB {0} [built]
    [1] ./css-loader/dist/runtime/api.js 2.35 KiB {0} [built]
Child extract-css-chunks-webpack-plugin css-loader/dist/cjs.js??ref--4-oneOf-1-1!postcss-loader/src/index.js??postcss!../../sass-loader/dist/cjs.js??ref--4-oneOf-1-3!../../../src/global.scss:
    [0] ./css-loader/dist/cjs.js??ref--4-oneOf-1-1!./postcss-loader/src??postcss!C:/Users/Ale/Documents/GitHub/pokeapi.co/node_modules/sass-loader/dist/cjs.js??ref--4-oneOf-1-3!C:/Users/Ale/Documents/GitHub/pokeapi.co/src/global.scss 735 bytes {0} [built]
    [1] ./css-loader/dist/runtime/api.js 2.35 KiB {0} [built]
Child extract-css-chunks-webpack-plugin css-loader/dist/cjs.js??ref--4-oneOf-4-1!postcss-loader/src/index.js??postcss!../../sanitize.css/sanitize.css:
    [0] ./css-loader/dist/cjs.js??ref--4-oneOf-4-1!./postcss-loader/src??postcss!C:/Users/Ale/Documents/GitHub/pokeapi.co/node_modules/sanitize.css/sanitize.css 10.1 KiB {0} [built]
    [1] ./css-loader/dist/runtime/api.js 2.35 KiB {0} [built]

                => There were ERRORS during the prod build stage! :(
                => Fix them and try again!

Version: webpack 4.41.2
Time: 5769ms
Built at: 04/29/2020 11:55:14 AM
        Asset     Size  Chunks  Chunk Names
static-app.js  170 KiB       0  main
 [0] external "react" 42 bytes {0} [built]
[10] external "@babel/runtime/helpers/extends" 42 bytes {0} [built]
[26] (webpack)/buildin/module.js 552 bytes {0} [built]
[28] external "@babel/runtime/helpers/objectWithoutProperties" 42 bytes {0} [built]
[32] C:/Users/Ale/Documents/GitHub/pokeapi.co/artifacts/react-static-browser-plugins.js 654 bytes {0} [built]
[33] external "C:\\Users\\Ale\\Documents\\GitHub\\pokeapi.co\\node_modules\\react-static\\lib\\browser" 42 bytes {0} [built]
[34] C:/Users/Ale/Documents/GitHub/pokeapi.co/artifacts/react-static-templates.js 5.55 KiB {0} [built]
[54] multi ../lib/bootstrapPlugins.js ../lib/bootstrapTemplates.js ../lib/bootstrapApp.js 52 bytes {0} [built]
[55] ../lib/bootstrapPlugins.js 472 bytes {0} [built]
[57] ../lib/bootstrapTemplates.js 722 bytes {0} [built]
[63] ../lib/bootstrapApp.js 1.48 KiB {0} [built]
[64] external "@babel/runtime/helpers/interopRequireWildcard" 42 bytes {0} [built]
[65] external "@babel/runtime/helpers/interopRequireDefault" 42 bytes {0} [built]
[66] external "C:\\Users\\Ale\\Documents\\GitHub\\pokeapi.co\\node_modules\\react-static\\lib\\browser\\hooks\\useStaticInfo" 42 bytes {0} [built]
[67] C:/Users/Ale/Documents/GitHub/pokeapi.co/src/index.js 715 bytes {0} [built]
    + 56 hidden modules

ERROR in C:/Users/Ale/Documents/GitHub/pokeapi.co/src/components/BreadCrumbs/BreadCrumbs.js
Module build failed (from C:/Users/Ale/Documents/GitHub/pokeapi.co/node_modules/babel-loader/lib/index.js):
SyntaxError: C:\Users\Ale\Documents\GitHub\pokeapi.co\src\components\BreadCrumbs\BreadCrumbs.js: Support for the experimental syntax 'nullishCoalescingOperator' isn't currently enabled (10:59):

   8 |     const activeEntryId = useActiveAnchor(entries.map(e => e.id));
   9 |     const activeEntry =
> 10 |         entries.find(entry => entry.id === activeEntryId) ?? entries[0];
     |                                                           ^
  11 |
  12 |     return (
  13 |         <React.Fragment>

Add @babel/plugin-proposal-nullish-coalescing-operator (https://git.io/vb4Se) to the 'plugins' section of your Babel config to enable transformation.
    at Object.raise (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\location.js:41:63)
    at Object.expectPlugin (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\util.js:165:18)
    at Object.parseExprOp (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\expression.js:358:16)
    at Object.parseExprOps (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\expression.js:313:17)
    at Object.parseMaybeConditional (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\expression.js:256:23)
    at Object.parseMaybeAssign (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\expression.js:186:21)
    at Object.parseVar (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\statement.js:985:26)
    at Object.parseVarStatement (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\statement.js:697:10)
    at Object.parseStatementContent (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\statement.js:211:21)
    at Object.parseStatement (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\statement.js:141:17)
    at Object.parseBlockOrModuleBlockBody (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\statement.js:860:25)
    at Object.parseBlockBody (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\statement.js:836:10)
    at Object.parseBlock (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\statement.js:813:10)
    at Object.parseFunctionBody (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\expression.js:1996:24)
    at Object.parseFunctionBodyAndFinish (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\expression.js:1941:10)
    at callback (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\statement.js:1071:12)
    at Object.withTopicForbiddingContext (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\expression.js:2485:14)
    at Object.parseFunction (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\statement.js:1069:10)
    at Object.parseExportDefaultExpression (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\statement.js:1781:19)
    at Object.parseExport (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\statement.js:1682:31)
    at Object.parseStatementContent (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\statement.js:251:25)
    at Object.parseStatement (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\statement.js:141:17)
    at Object.parseBlockOrModuleBlockBody (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\statement.js:860:25)
    at Object.parseBlockBody (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\statement.js:836:10)
    at Object.parseTopLevel (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\statement.js:47:10)
    at Object.parse (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\index.js:43:10)
    at parse (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\index.js:58:38)
    at parser (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\core\lib\transformation\normalize-file.js:168:34)
    at normalizeFile (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\core\lib\transformation\normalize-file.js:102:11)
    at runSync (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\core\lib\transformation\index.js:44:43)
    at runAsync (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\core\lib\transformation\index.js:35:14)
    at C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\core\lib\transform.js:34:34
    at processTicksAndRejections (internal/process/task_queues.js:79:11)
 @ C:/Users/Ale/Documents/GitHub/pokeapi.co/src/components/BreadCrumbs/index.js 1:0-40 1:0-40
 @ C:/Users/Ale/Documents/GitHub/pokeapi.co/src/components/DocsContainer/DocsContainer.js
 @ C:/Users/Ale/Documents/GitHub/pokeapi.co/src/components/DocsContainer/index.js
 @ C:/Users/Ale/Documents/GitHub/pokeapi.co/src/pages/docs/v2.js
 @ C:/Users/Ale/Documents/GitHub/pokeapi.co/artifacts/react-static-templates.js
 @ ../lib/bootstrapTemplates.js
 @ multi ../lib/bootstrapPlugins.js ../lib/bootstrapTemplates.js ../lib/bootstrapApp.js

ERROR in C:/Users/Ale/Documents/GitHub/pokeapi.co/src/components/JsonViewer/JsonViewer.js
Module build failed (from C:/Users/Ale/Documents/GitHub/pokeapi.co/node_modules/babel-loader/lib/index.js):
SyntaxError: C:\Users\Ale\Documents\GitHub\pokeapi.co\src\components\JsonViewer\JsonViewer.js: Support for the experimental syntax 'nullishCoalescingOperator' isn't currently enabled (37:54):

  35 |     }, []);
  36 |
> 37 |     const jsonString = JSON.stringify(data, null, 2) ?? '';
     |                                                      ^
  38 |     const jsonSize = new TextEncoder('utf-8').encode(jsonString).length / 1000; // kB
  39 |     const jsonLines = (jsonString.match(/\r?\n/g) || '').length + 1;
  40 |

Add @babel/plugin-proposal-nullish-coalescing-operator (https://git.io/vb4Se) to the 'plugins' section of your Babel config to enable transformation.
    at Object.raise (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\location.js:41:63)
    at Object.expectPlugin (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\util.js:165:18)
    at Object.parseExprOp (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\expression.js:358:16)
    at Object.parseExprOps (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\expression.js:313:17)
    at Object.parseMaybeConditional (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\expression.js:256:23)
    at Object.parseMaybeAssign (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\expression.js:186:21)
    at Object.parseVar (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\statement.js:985:26)
    at Object.parseVarStatement (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\statement.js:697:10)
    at Object.parseStatementContent (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\statement.js:211:21)
    at Object.parseStatement (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\statement.js:141:17)
    at Object.parseBlockOrModuleBlockBody (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\statement.js:860:25)
    at Object.parseBlockBody (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\statement.js:836:10)
    at Object.parseBlock (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\statement.js:813:10)
    at Object.parseFunctionBody (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\expression.js:1996:24)
    at Object.parseFunctionBodyAndFinish (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\expression.js:1941:10)
    at callback (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\statement.js:1071:12)
    at Object.withTopicForbiddingContext (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\expression.js:2485:14)
    at Object.parseFunction (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\statement.js:1069:10)
    at Object.parseExportDefaultExpression (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\statement.js:1781:19)
    at Object.parseExport (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\statement.js:1682:31)
    at Object.parseStatementContent (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\statement.js:251:25)
    at Object.parseStatement (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\statement.js:141:17)
    at Object.parseBlockOrModuleBlockBody (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\statement.js:860:25)
    at Object.parseBlockBody (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\statement.js:836:10)
    at Object.parseTopLevel (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\statement.js:47:10)
    at Object.parse (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\index.js:43:10)
    at parse (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\index.js:58:38)
    at parser (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\core\lib\transformation\normalize-file.js:168:34)
    at normalizeFile (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\core\lib\transformation\normalize-file.js:102:11)
    at runSync (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\core\lib\transformation\index.js:44:43)
    at runAsync (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\core\lib\transformation\index.js:35:14)
    at C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\core\lib\transform.js:34:34
    at processTicksAndRejections (internal/process/task_queues.js:79:11)
 @ C:/Users/Ale/Documents/GitHub/pokeapi.co/src/components/JsonViewer/index.js 1:0-39 1:0-39
 @ C:/Users/Ale/Documents/GitHub/pokeapi.co/src/pages/docs/v2.js
 @ C:/Users/Ale/Documents/GitHub/pokeapi.co/artifacts/react-static-templates.js
 @ ../lib/bootstrapTemplates.js
 @ multi ../lib/bootstrapPlugins.js ../lib/bootstrapTemplates.js ../lib/bootstrapApp.js

ERROR in C:/Users/Ale/Documents/GitHub/pokeapi.co/src/utils/useActiveAnchor.js
Module build failed (from C:/Users/Ale/Documents/GitHub/pokeapi.co/node_modules/babel-loader/lib/index.js):
SyntaxError: C:\Users\Ale\Documents\GitHub\pokeapi.co\src\utils\useActiveAnchor.js: Support for the experimental syntax 'nullishCoalescingOperator' isn't currently enabled (34:19):

  32 |     }, [ids]);
  33 |
> 34 |     return active ?? ids[0];
     |                   ^
  35 | }
  36 |

Add @babel/plugin-proposal-nullish-coalescing-operator (https://git.io/vb4Se) to the 'plugins' section of your Babel config to enable transformation.
    at Object.raise (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\location.js:41:63)
    at Object.expectPlugin (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\util.js:165:18)
    at Object.parseExprOp (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\expression.js:358:16)
    at Object.parseExprOps (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\expression.js:313:17)
    at Object.parseMaybeConditional (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\expression.js:256:23)
    at Object.parseMaybeAssign (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\expression.js:186:21)
    at Object.parseExpression (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\expression.js:134:23)
    at Object.parseReturnStatement (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\statement.js:584:28)
    at Object.parseStatementContent (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\statement.js:194:21)
    at Object.parseStatement (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\statement.js:141:17)
    at Object.parseBlockOrModuleBlockBody (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\statement.js:860:25)
    at Object.parseBlockBody (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\statement.js:836:10)
    at Object.parseBlock (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\statement.js:813:10)
    at Object.parseFunctionBody (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\expression.js:1996:24)
    at Object.parseFunctionBodyAndFinish (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\expression.js:1941:10)
    at callback (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\statement.js:1071:12)
    at Object.withTopicForbiddingContext (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\expression.js:2485:14)
    at Object.parseFunction (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\statement.js:1069:10)
    at Object.parseExportDefaultExpression (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\statement.js:1781:19)
    at Object.parseExport (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\statement.js:1682:31)
    at Object.parseStatementContent (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\statement.js:251:25)
    at Object.parseStatement (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\statement.js:141:17)
    at Object.parseBlockOrModuleBlockBody (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\statement.js:860:25)
    at Object.parseBlockBody (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\statement.js:836:10)
    at Object.parseTopLevel (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\statement.js:47:10)
    at Object.parse (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\parser\index.js:43:10)
    at parse (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\parser\src\index.js:58:38)
    at parser (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\core\lib\transformation\normalize-file.js:168:34)
    at normalizeFile (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\core\lib\transformation\normalize-file.js:102:11)
    at runSync (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\core\lib\transformation\index.js:44:43)
    at runAsync (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\core\lib\transformation\index.js:35:14)
    at C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\@babel\core\lib\transform.js:34:34
    at processTicksAndRejections (internal/process/task_queues.js:79:11)
 @ C:/Users/Ale/Documents/GitHub/pokeapi.co/src/components/TableOfContents/TableOfContents.js 5:0-58 10:20-35
 @ C:/Users/Ale/Documents/GitHub/pokeapi.co/src/components/TableOfContents/index.js
 @ C:/Users/Ale/Documents/GitHub/pokeapi.co/src/components/DocsContainer/DocsContainer.js
 @ C:/Users/Ale/Documents/GitHub/pokeapi.co/src/components/DocsContainer/index.js
 @ C:/Users/Ale/Documents/GitHub/pokeapi.co/src/pages/docs/v2.js
 @ C:/Users/Ale/Documents/GitHub/pokeapi.co/artifacts/react-static-templates.js
 @ ../lib/bootstrapTemplates.js
 @ multi ../lib/bootstrapPlugins.js ../lib/bootstrapTemplates.js ../lib/bootstrapApp.js

                => There were ERRORS during the node build stage! :(
                => Fix them and try again!

[✓] App Bundled (10.8s)
Fetching Site Data...
[✓] Site Data Downloaded (0.1s)
Fetching Route Data...
[=======] 7/7 100% 2333/s 0.0s
[✓] Route Data Downloaded (0.1s)
Exporting HTML across 8 threads...
Browserslist: caniuse-lite is outdated. Please run next command `npm update`
Browserslist: caniuse-lite is outdated. Please run next command `npm update`
Browserslist: caniuse-lite is outdated. Please run next command `npm update`
Browserslist: caniuse-lite is outdated. Please run next command `npm update`
Browserslist: caniuse-lite is outdated. Please run next command `npm update`
Browserslist: caniuse-lite is outdated. Please run next command `npm update`
Browserslist: caniuse-lite is outdated. Please run next command `npm update`
Browserslist: caniuse-lite is outdated. Please run next command `npm update`
  Error: Cannot find module 'C:\Users\Ale\Documents\GitHub\pokeapi.co\artifacts\static-app.js'
  Require stack:
  - C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\react-static\lib\static\exportRoutes.threaded.js

  - loader.js:982 Function.Module._resolveFilename
    internal/modules/cjs/loader.js:982:15

  - loader.js:864 Function.Module._load
    internal/modules/cjs/loader.js:864:27

  - loader.js:1044 Module.call
    internal/modules/cjs/loader.js:1044:19

  - binHelper.js:62 Module.require
    [pokeapi.co]/[react-static]/src/utils/binHelper.js:62:26

  - helpers.js:77 require
    internal/modules/cjs/helpers.js:77:18

  - exportRoutes.threaded.js:20 _callee2$
    [pokeapi.co]/[react-static]/src/static/exportRoutes.threaded.js:20:18

  - runtime.js:45 tryCatch
    [pokeapi.co]/[regenerator-runtime]/runtime.js:45:40

  - runtime.js:271 Generator.invoke [as _invoke]
    [pokeapi.co]/[regenerator-runtime]/runtime.js:271:22

  - runtime.js:97 Generator.prototype.<computed> [as next]
    [pokeapi.co]/[regenerator-runtime]/runtime.js:97:21

  - runtime.js:45 tryCatch
    [pokeapi.co]/[regenerator-runtime]/runtime.js:45:40

  - runtime.js:334 maybeInvokeDelegate
    [pokeapi.co]/[regenerator-runtime]/runtime.js:334:18

  - runtime.js:245 Generator.invoke [as _invoke]
    [pokeapi.co]/[regenerator-runtime]/runtime.js:245:32

  - runtime.js:97 Generator.prototype.<computed> [as next]
    [pokeapi.co]/[regenerator-runtime]/runtime.js:97:21

  - asyncToGenerator.js:3 asyncGeneratorStep
    [pokeapi.co]/[@babel]/runtime/helpers/asyncToGenerator.js:3:24

  - asyncToGenerator.js:25 _next
    [pokeapi.co]/[@babel]/runtime/helpers/asyncToGenerator.js:25:9

  - task_queues.js:97 processTicksAndRejections
    internal/process/task_queues.js:97:5


  Error: Trace: {
    code: 'MODULE_NOT_FOUND',
    requireStack: [
      'C:\\Users\\Ale\\Documents\\GitHub\\pokeapi.co\\node_modules\\react-static\\lib\\static\\exportRoutes.threaded.js'
    ]
  }
      at C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\react-static\bin\react-static:6:11
      at processTicksAndRejections (internal/process/task_queues.js:97:5)

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! pokeapi.co@ build: `react-static build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the pokeapi.co@ build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Ale\AppData\Roaming\npm-cache\_logs\2020-04-29T09_55_28_004Z-debug.log

@Naramsim
Copy link
Member

When I run npm run start I get the same ?? errors and as last error I get:

ERROR in C:/Users/Ale/Documents/GitHub/pokeapi.co/src/images/pokeapi_256.png
  Module build failed (from C:/Users/Ale/Documents/GitHub/pokeapi.co/node_modules/url-loader/dist/cjs.js):
  Error: Cannot find module 'file-loader'
  Require stack:
  - C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\url-loader\dist\index.js
  - C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\url-loader\dist\cjs.js
  - C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\loader-runner\lib\loadLoader.js
  - C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\loader-runner\lib\LoaderRunner.js
  - C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\webpack\lib\NormalModule.js
  - C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\webpack\lib\NormalModuleFactory.js
  - C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\webpack\lib\Compiler.js
  - C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\webpack\lib\webpack.js
  - C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\react-static\lib\static\webpack\runDevServer.js
  - C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\react-static\lib\commands\start.js
  - C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\react-static\bin\react-static
      at Function.Module._resolveFilename (internal/modules/cjs/loader.js:982:15)
      at Function.Module._load (internal/modules/cjs/loader.js:864:27)
      at Module.call (internal/modules/cjs/loader.js:1044:19)
      at Module.require (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\react-static\src\utils\binHelper.js:62:26)
      at require (internal/modules/cjs/helpers.js:77:18)
      at Object.loader (C:\Users\Ale\Documents\GitHub\pokeapi.co\node_modules\url-loader\dist\index.js:68:20)
   @ C:/Users/Ale/Documents/GitHub/pokeapi.co/src/App.js 8:0-44 98:13-17
   @ C:/Users/Ale/Documents/GitHub/pokeapi.co/src/index.js
   @ multi react-hot-loader/patch ../lib/bootstrapPlugins.js ../lib/bootstrapTemplates.js index.js

which is about file-loader.

@Naramsim
Copy link
Member

Hi @cmmartti, I would really like to merge this branch, I really think we need file-loader and get rid of the ??. I'm not a react-static expert at all, but on my PC I had to add those modifications in order to build the project.

It's not used directly (react-static uses it), but in some situations it
npm doesn't install it.
@cmmartti
Copy link
Member Author

@Naramsim I removed use of the nullish coalescing operator (??) and added the file-loader package. It should be ready to go now.

@Naramsim
Copy link
Member

Works perfectly on my machine, now the last thing is to modify the .circle/config.yml at line #33 so we deploy on Firebase the folder dist.

Then I would like to merge you branch to the staging one and trigger a staging deployment, so I see if it works or not :)

@Naramsim
Copy link
Member

@Naramsim
Copy link
Member

I also noticed that it happens also on your Netlify: https://musing-mcclintock-d866d7.netlify.app/

@cmmartti
Copy link
Member Author

Yeah, not entirely sure why that's happening. I've never seen it before. But I'm not at my computer right now so it will have to wait a bit.

@Naramsim
Copy link
Member

Yeah, no problem @cmmartti. It's not important :)

@Naramsim
Copy link
Member

I got the culprit, it's the GA library. I deployed a version without react-static-plugin-google-tag-manager and it works well: https://pokeapi-test-b6137.firebaseapp.com/

@cmmartti
Copy link
Member Author

We can just strip it out then, and add in Google Analytics manually. Feel free to go ahead and do it if you wish, as I won't have time to work on it for a couple of days.

@Naramsim Naramsim mentioned this pull request May 21, 2020
@Naramsim Naramsim merged commit 46778cd into PokeAPI:master May 21, 2020
@Naramsim
Copy link
Member

Naramsim commented May 21, 2020

Hi @cmmartti, in the end I think the issue is way broader. It's not a problem withing the GA package, but a problem running react-static build in CircleCI. It happens that CircleCI cannot build part of the website, and it doesn't report any errors. I believe the root cause is an internal configuration of Webpack which involves the use of threads.

If I check the output of react-static build I see that it exits with 0 but not all the routes are built and thus placed in the dist folder.

[✓] App Bundled (5s)
Fetching Site Data...
[✓] Site Data Downloaded (0.2s)
Fetching Route Data...
[=======] 7/7 100% 7000/s 0.0s
[✓] Route Data Downloaded (0.7s)
Exporting HTML across 36 threads...
[=====--] 5/7 71% 5/s 0.4s circleci@130dd40b0178:~/project$

Note the [=====--] with two -s.

I also saw that react-static uses 32 threads which on the machine there are only 2. This is because of this, in fact require('os').cpus() returns a list long 32. So I believe that some threads are lost and thus some pages are not generated.

I tried to overcome the issue with taskset to limit the number of CPUs used but with no luck, Node always reads 32.

I honestly don't know how to resolve this issue and I cannot find anything online that could help.

PS: When on CircleCI and running react-static build I always get a different number of elements inside the dist folder (ls -la | wc -l). Usually around 70 elements which are far below the 102 that are generated on my PC.

Naramsim added a commit that referenced this pull request May 21, 2020
@Naramsim
Copy link
Member

In the end I moved the execution of the build process from docker containers to the machine executor inside CircleCI. Now the CPUs are correctly detected and the build phase of react-static completes successfully.

:)

I should add back GA

@cmmartti
Copy link
Member Author

Sorry I wasn't able to figure it out. I just haven't had time these last few days to think about it.

React-Static isn't a very popular static site generator, and even the creator (Tanner Linsley, of React-Table and React-Query, among others) has abandoned it in favour of Next.js. However, I didn't find this out until after I'd already almost finished migrating the website to it. React-Static is still maintained by a company that uses it, and there's a new major version planned, but there's not a lot of people using it or working on it. I probably wouldn't use it again because of bugs like the ones we've run into, even though I like it a lot.

Fortunately, it should be super easy to switch to another SSG in future if we need to now that the code has been cleaned up. Next.js recently got proper static site support, and I probably would have used that instead if I'd known it was coming.

HRKings pushed a commit to HRKings/pokeapi.co that referenced this pull request Jan 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants