
Vite Changelog.
Link 1.0.35 · 2024.08.13
added - 2024.08.13
- Added a
craft.vite.integrity()method that will extract the integrity hash (for building a Content Security Policy) - Added an
includeScriptOnloadHandlerconfig setting that allows you to disable the adding of anonloadhandler on the<script>tags (useful when implementing a Content Security Policy)
changed - 2024.08.13
- Filter out empty attributes so they don't render on the
<script>tags
fixed - 2024.08.13
- Use
strrposinstead ofstrposwhen attempting to extract a file name without the hash (#28)
Link 1.0.34 · 2024.03.02
fixed - 2024.03.02
- Fixed an issue where the wrong CSS hash would be returned if you were using Vite 3 or earlier (#80)
- Fixed an issue where
craft.vite.entry()would fail if you were using Vite 5 or later, due to theManifestHelper::fileNameWithoutHash()function not working correctly (#24)
Link 1.0.33 · 2024.01.30
added - 2024.01.30
- If the
devServeris running, theViteService::fetch()method will try to use thedevServerInternalURL first, falling back on thedevServerPublicso thatcraft.vite.inline()can pull from thedevServerif it is running (#22) - Add
phpstanandecscode linting - Add
code-analysis.yamlGitHub action
changed - 2024.01.30
- Updated docs to use node 20 & a new sitemap plugin
- PHPstan code cleanup
- ECS code cleanup
Link 1.0.32 · 2023.12.08
fixed - 2023.12.08
- Fixed a type error if you passed an array of entries into the
errorEntryconfig (#76) - Fixed an issue where the
craft.vite.getCssHash()function didn't work with Vite 5, because it now uses a-to separate the version hash (#21)
Link 1.0.31 · 2023.06.07
added - 2023.06.07
- Add the
getCssInlineTags()function to theViteVariableso it's accessible via Twig templates - Added the
create-releaseGitHub workflow to automate release tagging
Link 1.0.30 · 2023.01.25
changed - 2023.01.25
- Updated the
craft.vite.asset()function to work with Vite 3.x or later, where assets are stored as top-level entries in themanifest.json(#56) (#31) - You can now include CSS manually if it's a top-level entry in your
vite.config.js(rather than being imported into your JavaScript) viacraft.vite.asset("src/css/app.css")(#31)
Link 1.0.29 · 2023.01.01
changed - 2023.01.01
- Move to using
ServicesTraitand add getter methods for services - Update the docs to use Vitepress
^1.0.0-alpha.29
fixed - 2023.01.01
- Fixed an issue where
craft.vite.includeCriticalCssTags()would fail if you hadtemplatein the file path (#45)
Link 1.0.28 · 2022.09.09
added - 2022.09.09
- Added support for detecting dev-mode in Craft CMS v4 by changing
App::env('ENVIRONMENT') === 'dev' - to
App::env('ENVIRONMENT') === 'dev' || App::env('CRAFT_ENVIRONMENT') === 'dev'(#41)
fixed - 2022.09.09
- Set the
ViteServiceconfig in the constructor, so that settings from theconfig/vite.phpare pre-populated before theViteService::init()method is called (#44)
Link 1.0.27 · 2022.07.16
changed - 2022.07.16
- Fixed an issue where
checkDevServerdidn't work with Vite 3, because they removed the intercepting of__vite_ping(#37)
Link 1.0.26 · 2022.06.29
changed - 2022.06.29
- Adds a boolean as a second param to the
craft.vite.asset(url, true)so that assets in the vite public folder can be referenced correctly from Twig (#10)
Link 1.0.25 · 2022.05.15
fixed - 2022.05.15
- Fixed an issue where the plugin couldn't detect the Vite dev server by testing
__vite_pinginstead of@vite/clientto determine whether the dev server is running or not (#33) (#8)
Link 1.0.24 · 2022.03.22
changed - 2022.03.22
- Only clear caches in
init()if we're using the dev server - Cache the status of the devServer for the duration of the request
Link 1.0.23 · 2022.01.21
fixed - 2022.01.21
- Removed errant debugging code
Link 1.0.22 · 2022.01.20
added - 2022.01.20
- Added support for subresource integrityvia plugins like vite-plugin-manifest-sri
Link 1.0.21 · 2022.01.17
added - 2022.01.17
- Added a
vite-script-loadedevent dispatched todocumentso listeners can be notified after a scriptloads (#310)
Link 1.0.20 · 2021.12.16
fixed - 2021.12.16
Link 1.0.19 · 2021.12.15
added - 2021.12.15
- Added the
.entry()function to retrieve and entry from themanifest.jsonto a JavaScript file, CSS file, or asset
Link 1.0.18 · 2021.12.14
fixed - 2021.12.14
- Fixed an issue where the needle/haystack logic was reversed in
strpos()which could cause it to not match properlyin some setups (#5)
Link 1.0.17 · 2021.10.21
fixed - 2021.10.21
- Fixed an issue with potentially duplicated
modulepreloadlinks by adding tags via an associativearray (#16)
Link 1.0.16 · 2021.09.18
added - 2021.09.18
- Added
craft.vite.asset()to retrive assets such as images that are imported in JavaScript or CSS
Link 1.0.15 · 2021.08.25
changed - 2021.08.25
- Changed the
DEVMODE_CACHE_DURATIONto1second (#3)
Link 1.0.14 · 2021.08.10
added - 2021.08.10
- Added Preload Directives Generation that willautomatically generate
<link rel="modulepreload">directives for entry chunks and their directimports (PR#2)
Link 1.0.13 · 2021.07.14
added - 2021.07.14
- Added a
craft.vite.devServerRunning()method to allow you to determine if the Vite dev server is running or not fromyour Twig templates (#10)
Link 1.0.12 · 2021.07.14
changed - 2021.07.14
- Switched the
checkDevServertest file to@vite/clientto accommodate with the change in Vite^2.4.0to usethe.mjsextension (#11)
Link 1.0.11 · 2021.06.29
changed - 2021.06.29
- Roll back the automatic inclusion of
@vite/client.js(#9)
Link 1.0.10 · 2021.06.28
changed - 2021.06.28
- Always include the
@vite/client.jsscript if the dev server isrunning (#9)
Link 1.0.9 · 2021.06.05
added - 2021.06.05
- Added
craft.vite.getCssHash()that returns the content hash for the build CSS assets
Link 1.0.8 · 2021.06.05
added - 2021.06.05
- Added
craft.vite.includeCriticalCssTags()to make it easy to include inline Critical CSS generatedviarollup-plugin-critical
Link 1.0.7 · 2021.05.21
added - 2021.05.21
- Added a
includeReactRefreshShimsetting that will automatically include therequired shim forreact-refreshwhen theVite dev server is running (#5)
changed - 2021.05.21
- Removed custom user/agent header that was a holdover from
curl - Re-worked how the various JavaScript shims are stored and injected
Link 1.0.6 · 2021.05.20
changed - 2021.05.20
- Change the default
useDevServersettingtoApp::env('ENVIRONMENT') === 'dev'(#6) - Refactored the code from a monolithic
ViteServiceto helpers, as appropriate
fixed - 2021.05.20
- Fixed an issue where it was outputting
type="nomodule"for legacy scripts, when it should have just beennomodule
Link 1.0.5 · 2021.05.14
added - 2021.05.14
- Moved the live reload through Twig errors to the ViteService so that plugins can get it too
- Added
.inline()to allow for inlining of local or remote files in your templates, with a caching layer
changed - 2021.05.14
- Use
registerJsFile()instead ofregisterScript() - Make the cache last for 30 seconds with
devModeon - Refactored to
ViteVariableInterface&ViteVariableTrait
Link 1.0.4 · 2021.05.08
added - 2021.05.08
- Added the
devServerInternalsetting back in, along withcheckDevServerfor people who want the fallbackbehavior (#2)
changed - 2021.05.08
- Use
PRIMARY_SITE_URLin the default config instead ofSITE_URL - Switch over to VitePress for the docs
Link 1.0.3 · 2021.05.07
changed - 2021.05.07
- Crawl the
manifest.jsondependency graph recursively to look for CSS files
fixed - 2021.05.07
- Don't call any AssetManager methods in the component
init()method during console requests
Link 1.0.2 · 2021-05-06
changed - 2021-05-06
- Removed entirely the
devServerInternalsetting, which isn't necessary (we just depend on you settingtheuseDevServerflag correctly instead), and added setup complexity
Link 1.0.1 · 2021-05-04
changed - 2021-05-04
- Added initial documentation
- Updated default
config.php
Link 1.0.0 · 2021-05-03
added - 2021-05-03
- Initial release
Related articles
