Skip to content

Commit

Permalink
Merge pull request #43 from nextcloud-libraries/feat/add-base-url-for…
Browse files Browse the repository at this point in the history
…-module-preloading

feat(appconfig): Add base path so module preloading works
  • Loading branch information
susnux authored Oct 12, 2023
2 parents 7af5c2a + 3057128 commit 9db641a
Show file tree
Hide file tree
Showing 3 changed files with 395 additions and 10 deletions.
12 changes: 11 additions & 1 deletion lib/appConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,18 @@ export const createAppConfig = (entries: { [entryAlias: string]: string }, optio
// Extended config for apps
const overrides: UserConfig = {
plugins,
// we need to set the base path, so module preloading works correctly
// currently this is hidden behind the `experimental` options.
experimental: {
renderBuiltUrl(filename) {
return {
// already contains the "js/" prefix as it is our output file configuration
runtime: `OC.filePath('${appName}', '', '${filename}')`,
}
},
},
build: {
/* Output dir is the project root to allow main style to be generated within `/css` */
// Output dir is the project root to allow main style to be generated within `/css`
outDir: '',
emptyOutDir: false, // ensure project root is NOT emptied!
rollupOptions: {
Expand Down
Loading

0 comments on commit 9db641a

Please sign in to comment.