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 includeScriptOnloadHandler config setting that allows you to disable the adding of an onload handler 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 strrpos instead of strpos when 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 the ManifestHelper::fileNameWithoutHash() function not working correctly (#24)

Link 1.0.33 · 2024.01.30

added - 2024.01.30

  • If the devServer is running, the ViteService::fetch() method will try to use the devServerInternal URL first, falling back on the devServerPublic so that craft.vite.inline() can pull from the devServer if it is running (#22)
  • Add phpstan and ecs code linting
  • Add code-analysis.yaml GitHub 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 errorEntry config (#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 the ViteVariable so it's accessible via Twig templates
  • Added the create-release GitHub 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 the manifest.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) via craft.vite.asset("src/css/app.css") (#31)

Link 1.0.29 · 2023.01.01

changed - 2023.01.01

  • Move to using ServicesTrait and 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 had template in 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 ViteService config in the constructor, so that settings from the config/vite.php are pre-populated before the ViteService::init() method is called (#44)

Link 1.0.27 · 2022.07.16

changed - 2022.07.16

  • Fixed an issue where checkDevServer didn'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_ping instead of @vite/client to 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


Link 1.0.21 · 2022.01.17

added - 2022.01.17

  • Added a vite-script-loaded event dispatched to document so listeners can be notified after a scriptloads (#310)

Link 1.0.20 · 2021.12.16

fixed - 2021.12.16

  • Fixed a regression caused by #5 to ensure assets load onproduction (#6)

Link 1.0.19 · 2021.12.15

added - 2021.12.15

  • Added the .entry() function to retrieve and entry from the manifest.json to 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 modulepreload links 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_DURATION to 1 second (#3)

Link 1.0.14 · 2021.08.10

added - 2021.08.10


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 checkDevServer test file to @vite/client to accommodate with the change in Vite ^2.4.0 to usethe .mjs extension (#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.js script 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 generatedvia rollup-plugin-critical

Link 1.0.7 · 2021.05.21

added - 2021.05.21

  • Added a includeReactRefreshShim setting that will automatically include therequired shim for react-refresh when 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 useDevServer settingto App::env('ENVIRONMENT') === 'dev' (#6)
  • Refactored the code from a monolithic ViteService to helpers, as appropriate

fixed - 2021.05.20

  • Fixed an issue where it was outputting type="nomodule" for legacy scripts, when it should have just been nomodule

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 of registerScript()
  • Make the cache last for 30 seconds with devMode on
  • Refactored to ViteVariableInterface & ViteVariableTrait

Link 1.0.4 · 2021.05.08

added - 2021.05.08

  • Added the devServerInternal setting back in, along with checkDevServer for people who want the fallbackbehavior (#2)

changed - 2021.05.08

  • Use PRIMARY_SITE_URL in the default config instead of SITE_URL
  • Switch over to VitePress for the docs

Link 1.0.3 · 2021.05.07

changed - 2021.05.07

  • Crawl the manifest.json dependency 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 devServerInternal setting, which isn't necessary (we just depend on you settingthe useDevServer flag 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