Edit websitestrings in litium /

Hi,
When I go in to edit my websitestrings I can’t see the same options in the test environment as my development environment. Has anyone seen this behavior before?


Litium version: 7 beta

The only thing that I can see on my computer is that the other tab will show up after all content + images have been loaded on first tab. Sometimes the images take some extra second and delay the tabs.

Can this be the case for you also?

If you have developer console, will that write out any errors?

I get an 404error. It looks like there is a javascript module that is missing.

vendor.js?v=2AA090D10A67DF03D0018D201C6B255E6F60D55CC9AD3A97D647AFAFE05A82C6:396 ERROR Error: Uncaught (in promise): Error: Loading chunk Accelerator failed.

It looks like you are using custom field type for the website and the UI could not load that javascript chunk. We need to re-build it. Here is how:

Navigate to Litium.Accelerator.FieldTypes folder, using the command prompt and execute:
yarn install (or npm install)
yarn run prod (or npm run prod)

Build the Accelerator solution.

Then try to edit the website string.

1 Like

Got it working after I rebuilt the js and check the option to remove files at publish. It didn’t work if that option was not checked

I’m having this issue again. When I select a website and entering the settings page I’m getting this error and the tabs are not loaded:
Error: Loading chunk Accelerator failed

I have tried to rebuild the js but it doesn’t solve the problem when I am publishing the site. It’s still the same. Please advise how to deal with this

I don’t know if it will help. But I was getting the same issue when deploying with the Debug Solution Configuration. We fixed it by changing to the Release Configuration.

1 Like

Solved it thanks to @PontvsXlent tips. I had a new build configuration that I had to include in the accelerator.FieltTypes csproj file where it specified when to include the accelerator.js files.

@patric.forsgard This is the same issue i reported as a bug. Why is there a configuration to only include this i release build? We need different configurations since we want to utlilize config transformation for different deployment environments but it doesnt work since only release includes these files.

44364 - Problem with Accelerator FieldTypes when deploying via webdeploy

44354 - Website fields not visible or editable

The routing for custom FieldTypes script is done in ExtensionsModuleRouterInitTask.cs. It should work in both debug and release modes. I am not sitting at my computer so I can’t tell you why it does not work on your machine.

If you use multiple different build configurations you may need to change the csproj-file for the project and also the ExtensionsModuleRouterInitTask to build and include the compiled js-file as a resource.

The csproj-file is the section

  <ItemGroup>
    <EmbeddedResource Include="dist\Accelerator.js" Condition="'$(Configuration)' == 'Release' OR $(DefineConstants.Contains('BUILD_PACKAGE'))" />
  </ItemGroup>
  <ItemGroup>
    <EmbeddedResource Include="dist\Accelerator.js.map" Condition="'$(Configuration)' == 'Release' OR $(DefineConstants.Contains('BUILD_PACKAGE'))" />
  </ItemGroup>

in this snippet we can see that the we include the embedded resource if the configuration is release or the definition constant BUILD_PACKAGE is set.

If we check the ExtensionsModuleRouterInitTask it looks like the following

        public void Init(IEnumerable<Assembly> assemblies)
        {
#if DEBUG && !BUILD_PACKAGE
            PackageManager.Register("~/Litium/Client/Scripts/dist", new DirectoryInfo($"{HostingEnvironment.MapPath("~/")}../{GetType().Assembly.GetName().Name}/dist").FullName);
#else
            PackageManager.Register("~/Litium/Client/Scripts", GetType().Assembly);
#endif
        }

where we can see that we using the embedded resource if we not building in DEBUG-mode and not have the BUILD_PACKAGE definition constant set.

So if you have more build configuration that you need to get the embedded resources included you can set the BUILD_PACKAGE definition constant in them.

The reason that we not included the generated JavaScript file when building in DEBUG is to allow the developer easy make changes in the JavaScript (TypeScript) source and get that changes included in the UI directly without needing to compile and restart the application.

I can see in the conditions from the csproj and the cs-file that the logic not is exactly the same but will correct that in next release.

If you want to do the changes by yourself it will be something like the following that will include the embedded files in all builds except the debug. Changes for the csproj, remeber to replace the nodes that already exists.

  <PropertyGroup Condition="'$(BuildPackage)' == 'true' Or '$(BuildUIPackage)' == 'true' Or '$(Configuration)' != 'Debug'">
    <DefineConstants>$(DefineConstants);BUILD_PACKAGE</DefineConstants>
  </PropertyGroup>
  <ItemGroup>
    <EmbeddedResource Include="dist\Accelerator.js" Condition="$(DefineConstants.Contains('BUILD_PACKAGE'))" />
    <EmbeddedResource Include="dist\Accelerator.js.map" Condition="$(DefineConstants.Contains('BUILD_PACKAGE'))" />
  </ItemGroup>

and the ExtensionsModuleRouterInitTask

#if BUILD_PACKAGE
            PackageManager.Register("~/Litium/Client/Scripts", GetType().Assembly);
#else
            PackageManager.Register("~/Litium/Client/Scripts/dist", new DirectoryInfo($"{HostingEnvironment.MapPath("~/")}../{GetType().Assembly.GetName().Name}/dist").FullName);
#endif

With this changes you may still have problem if you deploy a debug-build with webdeploy without explicit setting the BUILD_PACKAGE definition constant for debug builds.

1 Like