Skip to content

Commit b4062b7

Browse files
authored
Adds a README note explaining why TYPO3 asset concatenation/compression must be disabled in encore dev-server mode (#244)
* TASK: Adds a README note explaining why TYPO3 asset concatenation/compression must be disabled in Development context when using `encore dev-server` to ensure HMR works and avoid performance issues. * TASK: Adds a README note explaining why TYPO3 asset concatenation/compression must be disabled in encore dev-server mode.
1 parent 591f4ac commit b4062b7

File tree

1 file changed

+46
-23
lines changed

1 file changed

+46
-23
lines changed

README.md

Lines changed: 46 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -125,39 +125,62 @@ This way of using the AssetViewHelper is similar to the `asset` function used in
125125

126126
1. If you are in production mode and set enableVersioning(true) then you should set the option
127127

128-
```php
129-
$GLOBALS['TYPO3_CONF_VARS']['FE']['versionNumberInFilename'] = ''
130-
```
128+
```php
129+
$GLOBALS['TYPO3_CONF_VARS']['FE']['versionNumberInFilename'] = ''
130+
```
131131

132132
2. Defining Multiple Webpack Configurations ([see](https://symfony.com/doc/current/frontend/encore/advanced-config.html#defining-multiple-webpack-configurations))
133133

134-
Then you have to define your builds in your TypoScript-Setup:
134+
Then you have to define your builds in your TypoScript-Setup:
135135

136-
```php
137-
plugin.tx_typo3encore {
138-
settings {
139-
builds {
140-
firstBuild = EXT:typo3_encore/Resources/Public/FirstBuild
141-
secondBuild = EXT:typo3_encore/Resources/Public/SecondBuild
136+
```php
137+
plugin.tx_typo3encore {
138+
settings {
139+
builds {
140+
firstBuild = EXT:typo3_encore/Resources/Public/FirstBuild
141+
secondBuild = EXT:typo3_encore/Resources/Public/SecondBuild
142+
}
142143
}
143144
}
144-
}
145-
```
145+
```
146146

147-
Finally, you can specify which build to use:
147+
Finally, you can specify which build to use:
148148

149-
```php
150-
page.includeCSS {
151-
# Pattern typo3_encore:buildName:entryName
152-
app = typo3_encore:firstBuild:app
153-
}
154-
```
149+
```php
150+
page.includeCSS {
151+
# Pattern typo3_encore:buildName:entryName
152+
app = typo3_encore:firstBuild:app
153+
}
154+
```
155155

156-
```html
157-
{namespace encore = Ssch\Typo3Encore\ViewHelpers}
156+
```html
157+
{namespace encore = Ssch\Typo3Encore\ViewHelpers}
158158

159-
<encore:renderWebpackLinkTags entryName="app" buildName="firstBuild"/>
160-
```
159+
<encore:renderWebpackLinkTags entryName="app" buildName="firstBuild"/>
160+
```
161+
162+
3. **Important note on TYPO3 JS/CSS concatenation and compression while working with encore dev-server mode**
163+
164+
If you are using the Encore dev server (`encore dev-server`), ensure that TYPO3's asset concatenation and compression
165+
are disabled.
166+
167+
Enabling these options (`config.concatenateCss = 1`, `config.concatenateJs = 1`, `config.compressCss = 1`, or `config.compressJs = 1`)
168+
will prevent the dev server's hot module replacement (HMR) from working correctly. Additionally, TYPO3 may produce
169+
a large volume of temporary files (potentially gigabytes), significantly slowing down Docker-based development environments.
170+
171+
See [Issue #234](https://github.com/sabbelasichon/typo3_encore/issues/234) for more details.
172+
173+
Example TypoScript to disable concatenation/compression in Development:
174+
```typoscript
175+
[like(applicationContext, "Development*")]
176+
config {
177+
compressCss = 0
178+
concatenateCss = 0
179+
compressJs = 0
180+
concatenateJs = 0
181+
}
182+
[global]
183+
```
161184

162185
### CSS for CKEditor
163186

0 commit comments

Comments
 (0)