Hey all, I'm building an new backoffice
# package-development
o
Hey all, I'm building an new backoffice extension point and just recently I'm getting this error in U15, the extension still works but it would be nice to clear this error. Anyone seen it before and know how to fix? The file does exist. https://cdn.discordapp.com/attachments/882984798719729704/1396788317290496081/image.png?ex=687f5bfd&is=687e0a7d&hm=bc1e48179a6db6899f705624a69cceacf5d66e1219318eb3f9dea3c43b41f2b5&
s
What does your auth import statement look like? Did you try to clear the cache (delete
node_modules
and do a fresh
npm install
)?
o
Doing a clean install just now (again) and will see what happens.
Nope, didnt fix
Copy code
11:58:12 [vite] (client) Pre-transform error: Failed to resolve import "@umbraco-cms/backoffice/extension-registry" from "App_Plugins/MyProject/index-CmOw9dJJ.js". Does the file exist?
  Plugin: vite:import-analysis
  File: C:/Users/Owain Williams/Dev/xxxx-website/xxxx.Web/App_Plugins/MyProject/index-CmOw9dJJ.js:8:40
and
Copy code
11:58:12 [vite] Internal server error: Failed to resolve import "@umbraco-cms/backoffice/auth" from "App_Plugins/MyProject/entrypoint-C0XIkctw.js". Does the file exist?
  Plugin: vite:import-analysis
  File: C:/Users/Owain Williams/Dev/xxx-website/MyProject.Web/App_Plugins/MyProject/entrypoint-C0XIkctw.js:1:40
  1  |  import { UMB_AUTH_CONTEXT as i } from "@umbraco-cms/backoffice/auth";
     |                                         ^
  2  |  import { c as r } from "./index-CmOw9dJJ.js";
  3  |  const m = (s, n) => {
import { UMB_AUTH_CONTEXT } from "@umbraco-cms/backoffice/auth";
import { UmbConditionBase } from '@umbraco-cms/backoffice/extension-registry';
I think I may have found the issue. Bad javascript I think, although it doesnt throw errors when I compile, I can see intellisense errors when I open up the files.
ignore that - that was VS just being stupid - so stillgetting the issues above.
s
yeah the import looks fine, so that's not it either.. strange, not sure! I mean you have looked to see that the mentioned file exists?
what does your vite.config.ts look like?
o
Oh, you might be on to something here. My Project.Web folder isn't building my Extension - I have a vite.config but it's doing other stuff so I need to manually build via the Client folder of my extension. hmmm
Nope. Out of ideas. Everything works so I'll come back to it later.
s
did you start with Lotte's opinionated starter template?
Copy code
import { defineConfig } from "vite";

export default defineConfig({
  build: {
    lib: {
      entry: "src/bundle.manifests.ts", // Bundle registers one or more manifests
      formats: ["es"],
      fileName: "cultiv-test",
    },
    outDir: "../wwwroot/App_Plugins/CultivTest", // your web component will be saved in this location
    emptyOutDir: true,
    sourcemap: true,
    rollupOptions: {
      external: [/^@umbraco/],
    },
  }
});
Should look something like this and the
rollupOptions
are important here. From the error it looks like your entrypoint is trying to directly access the auth library, but it needs to come from external.
o
Ye, used the starter template and everything works fine, it's as soon as I log in to the backoffice my terminal throws all those errors. Really odd.
2 Views