T
TyphonJSSolidor

System Works in Dev Mode but not after build

After updating to 0.1.1, I noticed something odd happening. The TITAN system now seems to work when I run in dev mode. But when I run a built version, there is nothing. It's just the base foundry system. Some debugging shows me that the init hook is not getting called, and I have no idea why. Any idea what could cause this?
S
Solidor270d ago
Init hook is in the built file so I dunno why its not working... Reverting to my old vite file apparently fixed it. Not sure why. I'll upload the working and non working versions
S
Solidor270d ago
Working version
S
Solidor270d ago
Non working version
S
Solidor270d ago
S
Solidor270d ago
Through process of elimination I was able to narrow it down to this. In the second, non-working vite config, the following has been removed.
define: {
'process.env': {}
},
define: {
'process.env': {}
},
This seems to be what causes the built version of the system to not work. If I add it back in, everything works again. Feel like this is worth mentioning, because the vite config is based off the one in the essential svelte esm. https://github.com/typhonjs-fvtt-demo/template-svelte-esm/blob/main/vite.config.mjs
GitHub
template-svelte-esm/vite.config.mjs at main · typhonjs-fvtt-demo/te...
Provides a basic Foundry module template w/ TRL and ES modules to generate your own module. - typhonjs-fvtt-demo/template-svelte-esm
TM
TyphonJS (Michael)265d ago
Let me know if you have a resolution to this. There should be no need for the process.env code block above as that would be Node related.
S
Solidor263d ago
So far my only resolution seems to be to add the process.env back in, but I will investigate and see if I can find something else that could cause this.
TM
TyphonJS (Michael)263d ago
The only thing I can think of is Vite version and Svelte version and something else external to TRL that causes an issue or is a temporary bug w/ the given external dependency as that is not required in building TRL apps. Is this issue only w/ the dev server? process.env is a Node concern, etc. Are there any error messages?
S
Solidor248d ago
No error message. The dev server works fine. Its the built version that never runs the init hook without it.
TM
TyphonJS (Michael)248d ago
Are you including other Node modules in your build?
S
Solidor61d ago
Just in case this trips up anyone else... I am starting a major rewrite / update of the titan system, and I found out why this was breaking. It was the tippy package. It requires you to define process.env. It was working fine in dev mode. But in production mode, it was causing the build to fail. https://atomiks.github.io/tippyjs/v6/faq/#im-getting-uncaught-referenceerror-process-is-not-defined
FAQ
The complete tooltip, popover, dropdown, and menu solution for the web
TM
TyphonJS (Michael)60d ago
Right on.. Yeah. I figured it was something external being bundled. Just a heads up. TRL 0.2.0 will have some minor breaking changes; nothing crazy like Foundry though. Basically callbacks will take an object now instead of separate arguments. I'll fully describe things on release. You'll just have to put {} around arguments in callbacks.
Want results from more Discord servers?
Add your server
More Posts
Error building after updating to TRL 0.1.1Recently updated the TITAN system to TRL 0.1.1, but when I `npm run build` it errors out. Not sure wTJSApplication Character Sheet odd behavior with unlinked tokensHas anyone else experienced weird when using a TJSApplication as a character sheet with unlinked tokTJSDocumentCollection best practices?Hi! I've got a little component I'm using whose purpose is basically to just show a tiny preview of Release `TRL 0.1.1` - Patch releaseGreets @FVTT ▹ Developer! I have just released a patch / fix release that fixes a small oversight iUncaught TypeError: $storeElementRoot is undefinedHi! Encountering the following error when trying to resize an application based on a TJSApplicationSPopcorn InitiativeJust opening a forum post to track @gerark progress w/ TRL & Svelte + an initial idea of implementinToken Action HUDLet's continue chatting about TAH here to keep track of discussion @larkinaboutPostcssConfig seem not workin with 0.1.0@mleahy sorry to bother i'm trying to use the postccs feature of the @typhonjs-fvtt/runtime on the TJSDocument for aggregating actor flags for Svelte ComponentI'm sure this is very simple, but I'm having a hard time understanding how to get this to work. MaybUpdate to ChatMessage outside of Svelte doesn't trigger reactivity on linked TJSDocumentI'm a bit confused about this... 1. When I render a ChatMessage via svelte, in the chat message sveRelease `TRL 0.1.0` - The journey to beta begins...Greets @FVTT ▹ Developer, I am very excited to announce the release of TRL `0.1.0`. This is a majorHow do I get the elementRoot of a ChatMessage?SvelteApplication provides `elementRoot` prop to components that implement it, which is very useful.Getting started with the GUI and understanding element rootIt's been a while, but I've been working on my Knowledge Recalled module since V11 is out, and my frDrag & Drop broke in v11Ok so something that broke for me when moving to v11 is drag&drop from both the items tab of the sidTJSDocument and Token Issues```js const tokens = cardData.targets .map(t => [t, fromUuidSync(t)]) .filter(([_, tSyrinControl & Svelte...I gather there is a bit to discuss... 😄Ver .11Not sure if this is the place to ask, but updated to v .7.11 foundry 10. Lost all quest data. FoldePackage Release: Foundry Summons (3rd party)Greets @everyone. I do try to use pings sparingly, but want to show a spotlight on @vauxs new packagCreating an interim TJSDocument / document attribute bridgeHi @wasp... Just moving discussion here as it is a better forum post. > So I have made a system wiTJSGameSettings with not registered settings.I am not sure what is happening in here. I have created an attachement to the existing Settings pag