Skip to content

Custom Component script.js not compiling #591

Answered by aaronmeder
Iain-g asked this question in Q&A
Discussion options

You must be logged in to vote

Hey @Iain-g it seems to work for me. I've added it as a minimal / empty component like this:
https://github.com/aaronmeder/various-code/tree/main/Flynt-Components/SiteBanner

To test I've added it this the templates/_document.twig file directly inside the <body>:
{{ renderComponent('SiteBanner') }}

When I open the site it will show the "init SiteBanner 👋🏻" output in the browser console as expected.

You should also be doing that if you haven't:

  • Add a .env file to your theme directory that contains VITE_DEV_SERVER_HOST=http://yourlocalwpsite.test (adjust the domain to point to your local Wordpress site)
  • Either run npm run start (and keep running) or npm run build:production in the theme dir…

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@Iain-g
Comment options

@aaronmeder
Comment options

Answer selected by Iain-g
@Iain-g
Comment options

@aaronmeder
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants