Closed joepagan closed 2 years ago
I found that this was linked to a dynamic content issue... causing a template error. A new line being added to an inline property in the markup specifically. This was revealed while running the dev-server when I finally had matching content across environments.
Unfortunately though... having cleared 100% of Vue warnings in the js console where dev server is running, then trying production build locally, I get a slightly different one vendor.a9b4a9a1.js:formatted:5262 Uncaught SyntaxError: 15
.
Is there a way to make these errors way more verbose on production builds?
Aaaaaand... figured out WHY, it was my php application minifying the markup that the vue components use as their templates. Of course this is entirely why I could not see the issue on anything but uat/production environments.
The contents of a <script type="text/x-template">
were over minified and the inline properties have no spaces which of course is an issue and wouldn't expect vue to make sense of that. As an example:
<script type="text/x-template" id="t-product-purchase-cta"><div><div v-if="customer"><div v-if="isAvailabileInCurrentZone"><product-price:sku="sku":sale-price="salePrice"></product-price>
...
This has already been opened as an issue on https://github.com/mrclay/minify/issues/674
I'll close this now
Describe the bug
Appreciate this is likely going to be instantly closed, but despite my efforts... my reproduction repo works! and would be very time consuming to setup as near identical as it's a php app using vite..., really struggling to find a solution so I don't know where else to turn would appreciate some pointers to investigate this further.
When running the dev server my app works fine... no issues. When running a production build
npm run build
, it builds ok, but when viewing a webpage in browser, the js console shows the vendor.js bundle file hits a syntax error.Of course it's all minified/mangled (and turning minify off in vite config makes no difference), line 23 above:
I guess sourcemaps are not working as they should here but, I found that this line it complains about is
node_modules/@vue/compiler-core/dist/compiler-core.esm-bundler.js:L14
.This unknown SyntaxError is only hit where I try attach a basic vue component to a vue root instance.
Thanks for your hard work and efforts
Reproduction
will try get the working one public tomorrow, eyes closing involuntarily rn
System Info
Used Package Manager
npm
Logs
Validations