Coder Social home page Coder Social logo

Comments (10)

tricki avatar tricki commented on July 28, 2024 1

Here you go: https://github.com/tricki/stencil-helmet-prerender-bug

A simple app starter with Helmet. I've also prepared the minifyJs: false "fix" in stencil.config.ts (commented out).

Note: There still seems to be a bug when prerendering (errors of missing files in console) so make sure to manually empty the www folder before each build.

from stencil-helmet.

splitinfinities avatar splitinfinities commented on July 28, 2024 1

I'll circle back soon!

from stencil-helmet.

tricki avatar tricki commented on July 28, 2024

Seems like it has something to do with minification. If I add minifyJs: false to stencil.config.ts the tags update correctly.

I've tracked it down to this line:

const isValidNode = (node: ChildNode) => validTagNames.indexOf(node.vtag as string) > -1;

.vtag seems to get minified incorrectly, see this screenshot:

image

I'm inspecting the children parameter (minified as a) of the Helmet functional component (minified as j), the tag name is in a[0].v but the minified isValidNode function (minified as B at the top) checks the t.u property which doesn't exist in the ChildNode.

Is this perhaps an issue with Stencil (specifically its minification) and not Helmet?

from stencil-helmet.

splitinfinities avatar splitinfinities commented on July 28, 2024

Hey folks, can you do me a huge favor? Help me by setting up a reproduction repo that I can use. I'd love to figure out how to fix this for yall but I need a quick way to recreate and hopefully fix quickly.

from stencil-helmet.

splitinfinities avatar splitinfinities commented on July 28, 2024

Made a little progress on this today FYI. Not as much as I wanted but I need to step back for the moment.

from stencil-helmet.

tricki avatar tricki commented on July 28, 2024

I'd love to help but I have no idea where to start. It seems to be a problem during minification but I can't figure out why it should happen here specifically. I've tried some work-arounds but no success yet.

from stencil-helmet.

tricki avatar tricki commented on July 28, 2024

FYI I just had the same problem in my own code when trying to access the properties of a VNode in a project that doesn't have @stencil/helmet installed, so it seems to be a problem with Stencil itself.

I created a separate issue in the main repo: ionic-team/stencil#3089

from stencil-helmet.

tricki avatar tricki commented on July 28, 2024

I just realized there's a prerelease version (0.3.3-0) which seems to fix this bug.

Here's the merged pull request switching from VNode to ChildNode: #10

So I'd say this issue can be closed as soon as 0.3.3 is released.

from stencil-helmet.

tricki avatar tricki commented on July 28, 2024

I just tested this again now that 0.3.3 and the issue seems to be resolved and the tags seem to update correctly.

I've updated my repro repo: https://github.com/tricki/stencil-helmet-prerender-bug/

from stencil-helmet.

mikaelkaron avatar mikaelkaron commented on July 28, 2024

I'm assuming from the above that this is now fixed since 188c0ea and we're able to close?

from stencil-helmet.

Related Issues (9)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.