trevortylerlee / astro-micro

Blog theme for Astro with search and comments built-in. Zero frameworks.
https://astro-micro.vercel.app
MIT License
173 stars 43 forks source link

PageFind Warnings when Deploying to Netifly #48

Closed mlevison closed 2 months ago

mlevison commented 2 months ago

'm attempting to deploy the https://github.com/trevortylerlee/astro-micro template to Netifly. When I build locally, I don't get any warnings. When I deploy to Netifly I get: :50:32 PM: public/pagefind/pagefind-highlight.js:966:16 - warning ts(80002): This constructor function may be converted to a class declaration. 2:50:32 PM: 966 function Mark2(ctx) { 2:50:32 PM: ~ 2:50:32 PM: public/pagefind/pagefind-highlight.js:855:46 - warning ts(6133): 'term' is declared but its value is never read. 2:50:32 PM: 855 _this10[fn](regex, 1, function(term, node) { 2:50:32 PM: ~~ 2:50:32 PM: public/pagefind/pagefind-highlight.js:702:45 - warning ts(6133): 'k' is declared but its value is never read. 2:50:32 PM: 702 dict.nodes.forEach(function(k, j) { 2:50:32 PM: ~ 2:50:32 PM: public/pagefind/pagefind-highlight.js:386:18 - warning ts(80002): This constructor function may be converted to a class declaration. 2:50:32 PM: 386 function Mark3(ctx) { 2:50:32 PM: ~~~~ 2:50:32 PM: public/pagefind/pagefind-highlight.js:75:18 - warning ts(80002): This constructor function may be converted to a class declaration. 2:50:32 PM: 75 function DOMIterator2(ctx) { 2:50:32 PM: ~~

Is this expected? Have I missed a config?

The solution I found (with help on discord) was to edit tsconfig:

{
  "exclude": ["public/pagefind"],
  "extends": "astro/tsconfigs/strict",
  "compilerOptions": {
    "strictNullChecks": true,
    "baseUrl": ".",
    "paths": {
      "@*": [
        "./src/*"
      ]
    }
  }
}
trevortylerlee commented 2 months ago

Hi Mark, thanks for filing this issue.

I just tried deploying to Netlify and it worked without any errors on my end.

Your solution (excluding the public/pagefind directory in tsconfig.json) seems like a good way to avoid this issue. I'll update the repo to prevent similar issues for other users.

To troubleshoot further:

  1. Try deploying directly by using Netlify's Git integration instead of building locally and then deploying
  2. If the warnings continue, please provide a minimal reproduction of the problem, including deployment settings on Netlify and any modifications made to the template

If you're still having issues please let me know and I'll look into this further!

mlevison commented 2 months ago

Trevor - thanks for the rapid response.

  1. The exclude has already worked it's magic so I will never know what else was in play.
  2. The deploy was via GitHub, I didn't even know there was another way ;-) (This emoji was hand rolled the old fashioned way)