Vite
Version 4.0.6
June 7, 2023
Added
- Add the
getCssInlineTags()
function to theViteVariable
so it's accessible via Twig templates - Added the
create-release
GitHub workflow to automate release tagging
Version 4.0.5
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 4.0.4
January 1, 2023
Changed
- Move to using
ServicesTrait
and 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 hadtemplate
in the file path (#45)
Version 4.0.3
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
ViteService
config in the constructor, so that settings from theconfig/vite.php
are pre-populated before theViteService::init()
method is called (#44)
Version 4.0.2
July 16, 2022
Changed
- Fixed an issue where
checkDevServer
didn't work with Vite 3, because they removed the intercepting of__vite_ping
(#37)
Version 4.0.1
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 (#9)
Version 4.0.0-beta.4
April 26, 2022
Changed
- Don't log the full exception on a Guzzle error, just log the message
Fixed
- Fix semver for
nystudio107/craft-plugin-vite
so it's not pinned to a specific version
Version 4.0.0-beta.3
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 4.0.0-beta.2
March 4, 2022
Fixed
- Updated types for Craft CMS
4.0.0-alpha.1
via Rector
Version 4.0.0-beta.1
February 7, 2022
Added
- Initial Craft CMS 4 compatibility
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-loaded
event dispatched todocument
so 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.json
to 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
modulepreload
links 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_DURATION
to1
second (#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
checkDevServer
test file to@vite/client
to accommodate with the change in Vite^2.4.0
to use the.mjs
extension (#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.js
script 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
includeReactRefreshShim
setting that will automatically include the required shim forreact-refresh
when 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
useDevServer
setting toApp::env('ENVIRONMENT') === 'dev'
(#6) - Refactored the code from a monolithic
ViteService
to 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
devMode
on - Refactored to
ViteVariableInterface
&ViteVariableTrait
Version 1.0.4
May 8, 2021
Added
- Added the
devServerInternal
setting back in, along withcheckDevServer
for people who want the fallback behavior (#2)
Changed
- Use
PRIMARY_SITE_URL
in the default config instead ofSITE_URL
- Switch over to VitePress for the docs
Version 1.0.3
May 7, 2021
Changed
- Crawl the
manifest.json
dependency 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
devServerInternal
setting, which isn't necessary (we just depend on you setting theuseDevServer
flag 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