Version 1.0.35
August 13, 2024
Added
- 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
- Filter out empty attributes so they don't render on the
<script>tags
Fixed
- Use
strrposinstead ofstrposwhen attempting to extract a file name without the hash (#28)
Version 1.0.34
March 2, 2024
Version 1.0.33
January 30, 2024
Added
- 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
- Updated docs to use node 20 & a new sitemap plugin
- PHPstan code cleanup
- ECS code cleanup
Version 1.0.31
June 7, 2023
Added
- Add the
getCssInlineTags()function to theViteVariableso it's accessible via Twig templates - Added the
create-releaseGitHub workflow to automate release tagging
Version 1.0.30
January 25, 2023
Changed
- 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)
Version 1.0.29
January 1, 2023
Changed
- Move to using
ServicesTraitand add getter methods for services - Update the docs to use Vitepress
^1.0.0-alpha.29
Fixed
- Fixed an issue where
craft.vite.includeCriticalCssTags()would fail if you hadtemplatein the file path (#45)
Version 1.0.28
September 9, 2022
Added
- 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
- Set the
ViteServiceconfig in the constructor, so that settings from theconfig/vite.phpare pre-populated before theViteService::init()method is called (#44)
Version 1.0.27
July 16, 2022
Changed
- Fixed an issue where
checkDevServerdidn't work with Vite 3, because they removed the intercepting of__vite_ping(#37)
Version 1.0.26
June 29, 2022
Changed
- 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)
Version 1.0.24
March 22, 2022
Changed
- Only clear caches in
init()if we're using the dev server - Cache the status of the devServer for the duration of the request
Version 1.0.23
January 21, 2022
Fixed
- Removed errant debugging code
Version 1.0.22
January 20, 2022
Added
- Added support for subresource integrity via plugins like vite-plugin-manifest-sri
Version 1.0.21
January 17, 2022
Added
- Added a
vite-script-loadedevent dispatched todocumentso listeners can be notified after a script loads (#310)
Version 1.0.19
December 15, 2021
Added
- Added the
.entry()function to retrieve and entry from themanifest.jsonto a JavaScript file, CSS file, or asset
Version 1.0.18
December 14, 2021
Fixed
- Fixed an issue where the needle/haystack logic was reversed in
strpos()which could cause it to not match properly in some setups (#5)
Version 1.0.17
October 21, 2021
Fixed
- Fixed an issue with potentially duplicated
modulepreloadlinks by adding tags via an associative array (#16)
Version 1.0.16
September 18, 2021
Added
- Added
craft.vite.asset()to retrive assets such as images that are imported in JavaScript or CSS
Version 1.0.15
August 25, 2021
Changed
- Changed the
DEVMODE_CACHE_DURATIONto1second (#3)
Version 1.0.14
August 10, 2021
Added
- Added Preload Directives Generation that will
automatically generate
<link rel="modulepreload">directives for entry chunks and their direct imports (PR#2)
Version 1.0.13
July 14, 2021
Added
- Added a
craft.vite.devServerRunning()method to allow you to determine if the Vite dev server is running or not from your Twig templates (#10)
Version 1.0.12
July 14, 2021
Changed
- Switched the
checkDevServertest file to@vite/clientto accommodate with the change in Vite^2.4.0to use the.mjsextension (#11)
Version 1.0.11
June 29, 2021
Changed
- Roll back the automatic inclusion of
@vite/client.js(#9)
Version 1.0.10
June 28, 2021
Changed
- Always include the
@vite/client.jsscript if the dev server is running (#9)
Version 1.0.9
June 5, 2021
Added
- Added
craft.vite.getCssHash()that returns the content hash for the build CSS assets
Version 1.0.8
June 5, 2021
Added
- Added
craft.vite.includeCriticalCssTags()to make it easy to include inline Critical CSS generated viarollup-plugin-critical
Version 1.0.7
May 21, 2021
Added
- Added a
includeReactRefreshShimsetting that will automatically include the required shim forreact-refreshwhen the Vite dev server is running (#5)
Changed
- Removed custom user/agent header that was a holdover from
curl - Re-worked how the various JavaScript shims are stored and injected
Version 1.0.6
May 20, 2021
Changed
- Change the default
useDevServersetting toApp::env('ENVIRONMENT') === 'dev'(#6) - Refactored the code from a monolithic
ViteServiceto helpers, as appropriate
Fixed
- Fixed an issue where it was outputting
type="nomodule"for legacy scripts, when it should have just beennomodule
Version 1.0.5
May 14, 2021
Added
- 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
- Use
registerJsFile()instead ofregisterScript() - Make the cache last for 30 seconds with
devModeon - Refactored to
ViteVariableInterface&ViteVariableTrait
Version 1.0.4
May 8, 2021
Added
- Added the
devServerInternalsetting back in, along withcheckDevServerfor people who want the fallback behavior (#2)
Changed
- Use
PRIMARY_SITE_URLin the default config instead ofSITE_URL - Switch over to VitePress for the docs
Version 1.0.3
May 7, 2021
Changed
- Crawl the
manifest.jsondependency graph recursively to look for CSS files
Fixed
- Don't call any AssetManager methods in the component
init()method during console requests
Version 1.0.2
May 6, 2021
Changed
- Removed entirely the
devServerInternalsetting, which isn't necessary (we just depend on you setting theuseDevServerflag correctly instead), and added setup complexity
Version 1.0.1
May 4, 2021
Changed
- Added initial documentation
- Updated default
config.php
Version 1.0.0
May 3, 2021
Added
- Initial release