Skip to content

Commit

Permalink
[TASK] Add temporary solution for origin problem
Browse files Browse the repository at this point in the history
  • Loading branch information
s2b committed Sep 28, 2023
1 parent c1d9d3f commit b6f58c8
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ The generated configuration makes sure that vite
* generates a `manifest.json` file
* outputs assets to a publicly accessible directory

**Note that you might need to set `VITE_DEV_ORIGIN` in the generated config file manually
to the URL of your vite dev server in order to be able to load generated assets (e. g.
font files referenced in a css file) correctly. There will probably be a cleaner solution
in an upcoming version of the extension.**

<details>
<summary><i>More Options</i></summary>

Expand Down
8 changes: 8 additions & 0 deletions Resources/Private/ViteConfigTemplates/glob.vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ const VITE_ENTRYPOINTS = [
const VITE_OUTPUT_PATH = 'public/_assets/vite/';
// ------------------------------------------------------

// Base URL that will be prepended to all referenced assets in dev mode
// e. g// Set this to the URL of your vite dev server,
. https://myproject.ddev.site:5173
const VITE_DEV_ORIGIN = '';

// Ignored patterns to speed up globbing
const VITE_PATTERN_IGNORE = ['**/node_modules/**', '**/.git/**'];

Expand All @@ -32,4 +37,7 @@ export default defineConfig({
outDir: resolve(rootPath, VITE_OUTPUT_PATH),
},
publicDir: false,
server: {
origin: VITE_DEV_ORIGIN,
},
});
8 changes: 8 additions & 0 deletions Resources/Private/ViteConfigTemplates/static.vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ const VITE_ENTRYPOINTS = [
const VITE_OUTPUT_PATH = 'public/_assets/vite/';
// ------------------------------------------------------

// Base URL that will be prepended to all referenced assets in dev mode
// Set this to the URL of your vite dev server,
// e. g. https://myproject.ddev.site:5173
const VITE_DEV_ORIGIN = '';

const rootPath = resolve(__dirname, VITE_TYPO3_ROOT);
export default defineConfig({
base: '',
Expand All @@ -26,4 +31,7 @@ export default defineConfig({
outDir: resolve(rootPath, VITE_OUTPUT_PATH),
},
publicDir: false,
server: {
origin: VITE_DEV_ORIGIN,
},
});

0 comments on commit b6f58c8

Please sign in to comment.