tanepiper/svelte-formula

run dev works but run build gives an error

Nrde opened this issue · 3 comments

Nrde commented

When I run a dev build on my localhost there's no errors, but when I try to build the project I get errors from every extra rule/check/enrichment I have made. My Javascript fu isn't that strong so be gentle...

> svelte-app@1.0.0 build
> routify -b && rollup -c && routify export && workbox injectManifest

[Routify] Generated routes in 7 ms

src/main.js → dist/build/bundle.js...
  5024 |        let t53;
  5025 |        let span10;
> 5026 |        let t54_value = (/*$enrichment*/ ctx[2]?.description?.contentLength || 0) + "";
       |                                               ^ Unexpected token: punc (.)
  5027 |        let t54;
  5028 |        let t55;
  5029 |        let t56;
Nrde commented

the above is triggered by

enrich: {
      description: {
        contentLength: (value) => value.length
      }
    }

Hi @Nrde is this also on Firefox? the ?. operator is new in JavaScript, but all the modern browsers should support it - although this is actually the svelte compiled app as far as I can see, so Rollup should be building it for your environment

Nrde commented

I mean when doing local development, doing "npm run dev" there's no errors and the app works just fine on localhost:5000

When doing "npm run build" I get the console log mentioned above. I just commented out all validators, enrich blocks and don't use them with the form fields to be able to compile the stuff.

But I seem to have so many other problems with the new routify so I'm not sure which part of my dev environment to blame anymore. If I find out what goes wrong I'll get back to this problem. So maybe I have to blame Routify for everything, it's a pita at the moment.