Skip to content

[!!!][TASK] Don't resolve symlinks in manifest identifiers - #35

Merged
s2b merged 1 commit into
mainfrom
task/preserveSymlinks
Mar 22, 2026
Merged

[!!!][TASK] Don't resolve symlinks in manifest identifiers#35
s2b merged 1 commit into
mainfrom
task/preserveSymlinks

Conversation

@s2b

@s2b s2b commented Mar 22, 2026

Copy link
Copy Markdown
Owner

This allows realpath() code to be removed from the TYPO3 extension.

This is a breaking change because the identifiers will change.
This will require the recent version of the TYPO3 extension,
which will attempt both variants (first without symlink resolving,
second with resolving using realpath() as before).

Resolves: #28

This allows `realpath()` code to be removed from the TYPO3 extension.

This is a breaking change because the identifiers will change.
This will require the recent version of the TYPO3 extension,
which will attempt both variants (first without symlink resolving,
second with resolving using `realpath()` as before).

Resolves: #28
@s2b
s2b force-pushed the task/preserveSymlinks branch from 4ad4da0 to a6a5bdd Compare March 22, 2026 11:10
@s2b
s2b merged commit 9d14ff9 into main Mar 22, 2026
4 checks passed
s2b added a commit to s2b/vite-asset-collector that referenced this pull request Mar 22, 2026
Previously, the extension always resolved symlinks to their original
location if a specific asset file was requested. This was due to vite
doing the same by default in the `manifest.json`. Version 3.0 of
`vite-plugin-typo3` disables this behavior (see
s2b/vite-plugin-typo3#35), which allows us on
the TYPO3 side to only use the resolving via `realpath()` as a fallback
if the plain path doesn't work.

This change should resolve a whole category of errors that have been
reported over the years. With the fallback, the impact for projects
should be minimal. The only real change without fallback is that the
vite dev server will now always use the specified symlink to access
resources during development:

previous markup when dev server is active:

```html
<script type="module" src="https://vite.myproject.ddev.site/packages/sitepackage/…">
```

markup after this change:

```html
<script type="module" src="https://vite.myproject.ddev.site/vendor/my-vendor/sitepackage/…">
```

In practice, this shouldn't lead to any problems, since the vite dev
server has access to both paths.

Resolves: #94
Resolves: #105
Resolves: #93
s2b added a commit to s2b/vite-asset-collector that referenced this pull request Mar 22, 2026
Previously, the extension always resolved symlinks to their original
location if a specific asset file was requested. This was due to vite
doing the same by default in the `manifest.json`. Version 3.0 of
`vite-plugin-typo3` disables this behavior (see
s2b/vite-plugin-typo3#35), which allows us on
the TYPO3 side to only use the resolving via `realpath()` as a fallback
if the plain path doesn't work.

This change should resolve a whole category of errors that have been
reported over the years. With the fallback, the impact for projects
should be minimal. The only real change without fallback is that the
vite dev server will now always use the specified symlink to access
resources during development:

previous markup when dev server is active:

```html
<script type="module" src="https://vite.myproject.ddev.site/packages/sitepackage/…">
```

markup after this change:

```html
<script type="module" src="https://vite.myproject.ddev.site/vendor/my-vendor/sitepackage/…">
```

In practice, this shouldn't lead to any problems, since the vite dev
server has access to both paths.

Resolves: #94
Resolves: #105
Resolves: #93
s2b added a commit to s2b/vite-asset-collector that referenced this pull request Mar 22, 2026
Previously, the extension always resolved symlinks to their original
location if a specific asset file was requested. This was due to vite
doing the same by default in the `manifest.json`. Version 3.0 of
`vite-plugin-typo3` disables this behavior (see
s2b/vite-plugin-typo3#35), which allows us on
the TYPO3 side to only use the resolving via `realpath()` as a fallback
if the plain path doesn't work.

This change should resolve a whole category of errors that have been
reported over the years. With the fallback, the impact for projects
should be minimal. The only real change without fallback is that the
vite dev server will now always use the specified symlink to access
resources during development:

previous markup when dev server is active:

```html
<script type="module" src="https://vite.myproject.ddev.site/packages/sitepackage/…">
```

markup after this change:

```html
<script type="module" src="https://vite.myproject.ddev.site/vendor/my-vendor/sitepackage/…">
```

In practice, this shouldn't lead to any problems, since the vite dev
server has access to both paths.

Resolves: #94
Resolves: #105
Resolves: #93
s2b added a commit to s2b/vite-asset-collector that referenced this pull request Mar 22, 2026
Previously, the extension always resolved symlinks to their original
location if a specific asset file was requested. This was due to vite
doing the same by default in the `manifest.json`. Version 3.0 of
`vite-plugin-typo3` disables this behavior (see
s2b/vite-plugin-typo3#35), which allows us on
the TYPO3 side to only use the resolving via `realpath()` as a fallback
if the plain path doesn't work.

This change should resolve a whole category of errors that have been
reported over the years. With the fallback, the impact for projects
should be minimal. The only real change without fallback is that the
vite dev server will now always use the specified symlink to access
resources during development:

previous markup when dev server is active:

```html
<script type="module" src="https://vite.myproject.ddev.site/packages/sitepackage/…">
```

markup after this change:

```html
<script type="module" src="https://vite.myproject.ddev.site/vendor/my-vendor/sitepackage/…">
```

In practice, this shouldn't lead to any problems, since the vite dev
server has access to both paths.

Resolves: #94
Resolves: #105
Resolves: #93
s2b added a commit to s2b/vite-asset-collector that referenced this pull request May 8, 2026
With previous iterations of the client-side vite setup, it was necessary
for the TYPO3 extension to resolve symlinks to their original location
in order to generate the matching identifiers for vite's manifest.json.
This lead to various problems related to the usage of `realpath()`,
especially in combination with `open_basedir` server configurations.

Since `vite-plugin-typo3` v3, the `resolve.preserveSymlinks` is used
to retain the original paths in the manifest.json. This makes
server-side symlink resolving obsolete and also doesn't require the
source asset files being present on production setups. For custom
vite setups, the flag can be specified manually in `vite.config.js`.

For v1, a fallback is in place in case symlink resolving is still
necessary. This fallback is now deprecated and will be removed with v2.

Path example:

`EXT:sitepackage/Resources/Private/Main.js` resolves to either
`vendor/myvendor/sitepackage/...` or `typo3conf/ext/sitepackage/...`
using TYPO3's path APIs. These are typically symlinks pointing to
`packages/sitepackage/...`, created by composer, however TYPO3 is not
aware of that and doesn't resolve them by default.

On the vite site, without the flag being set, `manifest.json` resolves
asset paths to their origin `packages/sitepackage/...`, following the
symlink. To access these assets from TYPO3, `realpath()` needed to be
used to resolve the symlink server-side as well to get matching paths.

With the flag being set, `manifest.json` contains the original symlink,
again either `vendor/myvendor/sitepackage/...` or
`typo3conf/ext/sitepackage/...`. This means that server-side symlink
resolving is no longer necessary.

Related change in vite-plugin-typo3:
s2b/vite-plugin-typo3#35
s2b added a commit to s2b/vite-asset-collector that referenced this pull request May 8, 2026
With previous iterations of the client-side vite setup, it was necessary
for the TYPO3 extension to resolve symlinks to their original location
in order to generate the matching identifiers for vite's manifest.json.
This lead to various problems related to the usage of `realpath()`,
especially in combination with `open_basedir` server configurations.

Since `vite-plugin-typo3` v3, the `resolve.preserveSymlinks` is used
to retain the original paths in the manifest.json. This makes
server-side symlink resolving obsolete and also doesn't require the
source asset files being present on production setups. For custom
vite setups, the flag can be specified manually in `vite.config.js`.

For v1, a fallback is in place in case symlink resolving is still
necessary. This fallback is now deprecated and will be removed with v2.

Path example:

`EXT:sitepackage/Resources/Private/Main.js` resolves to either
`vendor/myvendor/sitepackage/...` or `typo3conf/ext/sitepackage/...`
using TYPO3's path APIs. These are typically symlinks pointing to
`packages/sitepackage/...`, created by composer, however TYPO3 is not
aware of that and doesn't resolve them by default.

On the vite site, without the flag being set, `manifest.json` resolves
asset paths to their origin `packages/sitepackage/...`, following the
symlink. To access these assets from TYPO3, `realpath()` needed to be
used to resolve the symlink server-side as well to get matching paths.

With the flag being set, `manifest.json` contains the original symlink,
again either `vendor/myvendor/sitepackage/...` or
`typo3conf/ext/sitepackage/...`. This means that server-side symlink
resolving is no longer necessary.

Related change in vite-plugin-typo3:
s2b/vite-plugin-typo3#35
s2b added a commit to s2b/vite-asset-collector that referenced this pull request May 8, 2026
With previous iterations of the client-side vite setup, it was necessary
for the TYPO3 extension to resolve symlinks to their original location
in order to generate the matching identifiers for vite's manifest.json.
This lead to various problems related to the usage of `realpath()`,
especially in combination with `open_basedir` server configurations.

Since `vite-plugin-typo3` v3, the `resolve.preserveSymlinks` is used
to retain the original paths in the `manifest.json`. This makes
server-side symlink resolving obsolete and also doesn't require the
source asset files being present on production setups. For custom
vite setups, the flag can be specified manually in `vite.config.js`.

For v1, a fallback is in place in case symlink resolving is still
necessary. This fallback is now deprecated and will be removed with v2.

Path example:

`EXT:sitepackage/Resources/Private/Main.js` resolves to either
`vendor/myvendor/sitepackage/...` or `typo3conf/ext/sitepackage/...`
using TYPO3's path APIs. These are typically symlinks pointing to
`packages/sitepackage/...`, created by composer, however TYPO3 is not
aware of that and doesn't resolve them by default.

On the vite site, without the flag being set, `manifest.json` resolves
asset paths to their origin `packages/sitepackage/...`, following the
symlink. To access these assets from TYPO3, `realpath()` needed to be
used to resolve the symlink server-side as well to get matching paths.

With the flag being set, `manifest.json` contains the original symlink,
again either `vendor/myvendor/sitepackage/...` or
`typo3conf/ext/sitepackage/...`. This means that server-side symlink
resolving is no longer necessary.

Related change in vite-plugin-typo3:
s2b/vite-plugin-typo3#35
s2b added a commit to s2b/vite-asset-collector that referenced this pull request May 8, 2026
With previous iterations of the client-side vite setup, it was necessary
for the TYPO3 extension to resolve symlinks to their original location
in order to generate the matching identifiers for vite's `manifest.json`.
This lead to various problems related to the usage of `realpath()`,
especially in combination with `open_basedir` server configurations.

Since `vite-plugin-typo3` v3, the `resolve.preserveSymlinks` is used
to retain the original paths in the `manifest.json`. This makes
server-side symlink resolving obsolete and also doesn't require the
source asset files being present on production setups. For custom
vite setups, the flag can be specified manually in `vite.config.js`.

For v1, a fallback is in place in case symlink resolving is still
necessary. This fallback is now deprecated and will be removed with v2.

Path example:

`EXT:sitepackage/Resources/Private/Main.js` resolves to either
`vendor/myvendor/sitepackage/...` or `typo3conf/ext/sitepackage/...`
using TYPO3's path APIs. These are typically symlinks pointing to
`packages/sitepackage/...`, created by composer, however TYPO3 is not
aware of that and doesn't resolve them by default.

On the vite site, without the flag being set, `manifest.json` resolves
asset paths to their origin `packages/sitepackage/...`, following the
symlink. To access these assets from TYPO3, `realpath()` needed to be
used to resolve the symlink server-side as well to get matching paths.

With the flag being set, `manifest.json` contains the original symlink,
again either `vendor/myvendor/sitepackage/...` or
`typo3conf/ext/sitepackage/...`. This means that server-side symlink
resolving is no longer necessary.

Related change in vite-plugin-typo3:
s2b/vite-plugin-typo3#35
s2b added a commit to s2b/vite-asset-collector that referenced this pull request May 8, 2026
With previous iterations of the client-side vite setup, it was necessary
for the TYPO3 extension to resolve symlinks to their original location
in order to generate the matching identifiers for vite's `manifest.json`.
This lead to various problems related to the usage of `realpath()`,
especially in combination with `open_basedir` server configurations.

Since `vite-plugin-typo3` v3, `resolve.preserveSymlinks` is used
to retain the original paths in the `manifest.json`. This makes
server-side symlink resolving obsolete and also doesn't require the
source asset files being present on production setups. For custom
vite setups, the flag can be specified manually in `vite.config.js`.

For v1, a fallback is in place in case symlink resolving is still
necessary. This fallback is now deprecated and will be removed with v2.

Path example:

`EXT:sitepackage/Resources/Private/Main.js` resolves to either
`vendor/myvendor/sitepackage/...` or `typo3conf/ext/sitepackage/...`
using TYPO3's path APIs. These are typically symlinks pointing to
`packages/sitepackage/...`, created by composer, however TYPO3 is not
aware of that and doesn't resolve them by default.

On the vite site, without the flag being set, `manifest.json` resolves
asset paths to their origin `packages/sitepackage/...`, following the
symlink. To access these assets from TYPO3, `realpath()` needed to be
used to resolve the symlink server-side as well to get matching paths.

With the flag being set, `manifest.json` contains the original symlink,
again either `vendor/myvendor/sitepackage/...` or
`typo3conf/ext/sitepackage/...`. This means that server-side symlink
resolving is no longer necessary.

Related change in vite-plugin-typo3:
s2b/vite-plugin-typo3#35
s2b added a commit to s2b/vite-asset-collector that referenced this pull request May 8, 2026
With previous iterations of the client-side vite setup, it was necessary
for the TYPO3 extension to resolve symlinks to their original location
in order to generate the matching identifiers for vite's `manifest.json`.
This lead to various problems related to the usage of `realpath()`,
especially in combination with `open_basedir` server configurations.

Since `vite-plugin-typo3` v3, `resolve.preserveSymlinks` is used
to retain the original paths in the `manifest.json`. This makes
server-side symlink resolving obsolete and also doesn't require the
source asset files being present on production setups. For custom
vite setups, the flag can be specified manually in `vite.config.js`.

For v1, a fallback is in place in case symlink resolving is still
necessary. This fallback is now deprecated and will be removed with v2.

Path example:

`EXT:sitepackage/Resources/Private/Main.js` resolves to either
`vendor/myvendor/sitepackage/...` or `typo3conf/ext/sitepackage/...`
using TYPO3's path APIs. These are typically symlinks pointing to
`packages/sitepackage/...`, created by composer, however TYPO3 is not
aware of that and doesn't resolve them by default.

On the vite site, without the flag being set, `manifest.json` resolves
asset paths to their origin `packages/sitepackage/...`, following the
symlink. To access these assets from TYPO3, `realpath()` needed to be
used to resolve the symlink server-side as well to get matching paths.

With the flag being set, `manifest.json` contains the original symlink,
again either `vendor/myvendor/sitepackage/...` or
`typo3conf/ext/sitepackage/...`. This means that server-side symlink
resolving is no longer necessary.

Related change in vite-plugin-typo3:
s2b/vite-plugin-typo3#35
@s2b
s2b deleted the task/preserveSymlinks branch May 21, 2026 16:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use preserveSymlinks

1 participant