Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using Rolldown with Vite v6 #43

Draft
wants to merge 101 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
101 commits
Select commit Hold shift + click to select a range
3867e00
feat: use rolldown in the dep optimizer
sapphi-red Sep 11, 2024
dd39bfe
feat: use rolldown for build
sapphi-red Sep 12, 2024
07a041a
chore: skip plugin-legacy build
sapphi-red Sep 12, 2024
cbf8c71
chore: skip typecheck for now
sapphi-red Sep 12, 2024
d2fa425
chore: 🤖 add justfile for faster dev
IWANABETHATGUY Aug 15, 2024
a9c677e
feat: add experimental.enableNativePlugin (#41)
IWANABETHATGUY Sep 10, 2024
4f89eff
feat: clone class plugins correctly
IWANABETHATGUY Sep 13, 2024
e29c191
feat: native build plugins (#45) (#46)
IWANABETHATGUY Sep 12, 2024
8488b67
perf: reduce pre alias plugin in build mode
IWANABETHATGUY Sep 12, 2024
3fc4263
feat: 🎸 add an new option to disable build report
IWANABETHATGUY Sep 13, 2024
2167689
feat: support native define
sapphi-red Sep 18, 2024
1e225ae
feat: use filter for plugins (#49) (#50) (#51) (#52) (#53)
sapphi-red Sep 18, 2024
2ba74ab
perf: ⚡️ use default resolver (#56)
IWANABETHATGUY Sep 14, 2024
4c01be9
fix: 🐛 lint (#58)
IWANABETHATGUY Sep 20, 2024
fa6e48b
chore: bump rolldown
sapphi-red Sep 24, 2024
e57f02c
chore: skip data uri by load fallback plugin for native data uri hand…
sapphi-red Sep 24, 2024
642d93c
feat: handle non-relative paths by Vite's resolver for enableNativePl…
sapphi-red Sep 19, 2024
b762b67
chore: remove browser field edge case test
sapphi-red Sep 25, 2024
3993fd4
chore: use advancedChunks instead of manualChunks
sapphi-red Oct 1, 2024
f70d07b
feat: convert `optimizeDeps.esbuildOptions` to `optimizeDeps.rollupOp…
sapphi-red Oct 4, 2024
8f9dde6
fix: optimizeDeps test pass on windows
sapphi-red Oct 9, 2024
c26ecd3
chore: make some tests passing
sapphi-red Oct 9, 2024
e7fd14b
chore: make glob-import test pass with workarounds
sapphi-red Oct 9, 2024
3d69439
chore: run worker-es tests
sapphi-red Oct 9, 2024
2b07094
fix: use preliminaryFileName for chunkMetadata key
sapphi-red Oct 10, 2024
85e0a78
feat: oxc tranformer (#60)
underfin Oct 11, 2024
3985a78
feat: use `onlyRemoveTypeImports`
sapphi-red Oct 11, 2024
242978f
chore: enable continuous release under rolldown-vite (#61)
yyx990803 Oct 12, 2024
3130cf0
feat: environment aware native plugins
sapphi-red Oct 15, 2024
5bfdbe6
feat: export transformWithOxc (#62)
underfin Oct 17, 2024
dcffc34
feat: add oxc jsxInclude and jsxExclude (#63)
underfin Oct 18, 2024
8e60c28
chore: update some tests that relies on rollup's behavior
sapphi-red Oct 24, 2024
e450783
chore: skip environment-react-ssr for now
sapphi-red Oct 24, 2024
a51beb0
chore: bump rolldown
sapphi-red Oct 24, 2024
9dc11b8
chore: skip minifySyntax test as it relies on specific esbuild option
sapphi-red Oct 24, 2024
e8ecfa4
chore: fix type errors
sapphi-red Oct 24, 2024
f0e172a
chore: skip sideeffects set for HTML scripts for now
sapphi-red Nov 6, 2024
ffcf0ba
chore: tweak tests
sapphi-red Nov 6, 2024
2334a35
chore: bump rolldown
sapphi-red Nov 6, 2024
0f4e6ce
chore: enable backend-integration test
sapphi-red Nov 6, 2024
9919c44
chore: skip error message test
sapphi-red Nov 13, 2024
0c57882
feat: enable lib mode tests (#64)
sapphi-red Nov 13, 2024
c86f032
chore: fix LICENSE
sapphi-red Nov 14, 2024
2c4ea41
chore: uncomment things implemented on rolldown now
sapphi-red Nov 18, 2024
8774d4f
chore: enable html sideeffects test
sapphi-red Nov 18, 2024
8857548
chore: reduce diff
sapphi-red Nov 18, 2024
51d49b0
feat: use native Vite resolver (#65)
sapphi-red Nov 19, 2024
51a3096
chore: add workaround and make environment-react-ssr playground pass
sapphi-red Nov 21, 2024
14e77ae
chore: add comment
sapphi-red Nov 21, 2024
bb779da
chore: fix oxc option convertion and reduce warnings
sapphi-red Nov 22, 2024
91cb0ad
chore: bump rolldown
sapphi-red Nov 25, 2024
5e5ea2f
chore: update snapshot
sapphi-red Nov 25, 2024
c76da0a
chore: fix for new vite resolve plugin
sapphi-red Nov 25, 2024
ae4ee84
feat: use native plugin for create id resolver (#68)
sapphi-red Nov 25, 2024
ea37aff
chore: bump rolldown
sapphi-red Nov 28, 2024
9114ecb
chore: fix for the latest rolldown
sapphi-red Nov 28, 2024
3832bc9
chore: enable modulepreload unit test
sapphi-red Nov 28, 2024
9811dc0
chore: bump rolldown
sapphi-red Nov 29, 2024
a397a30
chore: set platform option and remove workaround in environment-react…
sapphi-red Nov 29, 2024
81fb641
chore: update some tests that relies on rollup's behavior
sapphi-red Nov 29, 2024
4ed2a68
feat: use rolldown for config loader (#69)
sapphi-red Nov 29, 2024
a230d3e
feat: use rolldown effectively for the optimizer (#70)
sapphi-red Nov 29, 2024
2250c58
feat: use oxc for non-native define plugin (#71)
sapphi-red Dec 3, 2024
8aa215d
feat: use lightningcss by default for cssMinify (#72)
sapphi-red Dec 3, 2024
3da97db
chore: reduce oxc not supported warnings
sapphi-red Dec 3, 2024
6fba311
feat: use rolldown minify (#73)
sapphi-red Dec 4, 2024
3a074cc
fix: isolate `chunk.viteMetadata` values for each build (#74)
hi-ogawa Dec 6, 2024
df0e31d
perf: do less on js side for optimizer (#76)
sapphi-red Dec 10, 2024
39373ce
chore: bump rolldown
sapphi-red Dec 11, 2024
f103fd1
chore: handle oxc errors
sapphi-red Dec 11, 2024
8432815
chore: change for latest native vite resolver plugin
sapphi-red Dec 6, 2024
45f9119
chore: getCombinedSourcemap is now supported
sapphi-red Dec 6, 2024
8d311c4
chore: set keepNames
sapphi-red Dec 6, 2024
626fbfa
chore: update sourcemap snapshot
sapphi-red Dec 11, 2024
63c9267
chore: enable some define tests
sapphi-red Dec 11, 2024
c412af3
chore: change for latest native json plugin
sapphi-red Dec 11, 2024
ec7e52c
chore: update modulePreloadPolyfill snapshot
sapphi-red Dec 11, 2024
2fe9e92
chore: reduce diff for Sourcemap::toUrl/Sourcemap::toString
sapphi-red Dec 11, 2024
9dea76a
chore: make external test pass by manually polyfilling require
sapphi-red Dec 11, 2024
8ab8f86
chore: remove workaround
sapphi-red Dec 11, 2024
98364b7
feat: use oxc for lowering (#77)
sapphi-red Dec 12, 2024
7cac7b4
feat: make esbuild optional peer dep (#78)
sapphi-red Dec 12, 2024
3a01e56
fix(css): inline css insert for single quote `use strict` (#79)
underfin Dec 16, 2024
212fcf1
chore: bump rolldown
sapphi-red Dec 16, 2024
105b6fe
chore: bump rolldown
sapphi-red Dec 19, 2024
c033639
chore: update for oxc.jsx type change
sapphi-red Dec 19, 2024
70f44ae
chore: update for PluginContext type change
sapphi-red Dec 19, 2024
c969ca4
fix: return transformed content as `moduleType: 'js'`
sapphi-red Dec 20, 2024
8fec77a
feat: use setPublicClassFields for useDefineForClassFields support
sapphi-red Dec 20, 2024
340c520
fix: set `onlyRemoveTypeImports: false` by default
sapphi-red Dec 20, 2024
332845c
chore: bump rolldown
sapphi-red Dec 20, 2024
8d0eb77
chore: tweak types
sapphi-red Dec 20, 2024
554cafd
chore: update some snapshots
sapphi-red Dec 26, 2024
ac1a022
chore: bump rolldown
sapphi-red Dec 26, 2024
1713041
chore: update snapshot
sapphi-red Dec 26, 2024
c1b96c1
chore: fix type
sapphi-red Dec 26, 2024
37dd335
chore: disable rolldown define process.env.NODE_ENV
sapphi-red Dec 26, 2024
d234655
chore: suppress rolldown minifier warning
sapphi-red Dec 26, 2024
837dccc
chore: use types from rolldown
sapphi-red Dec 26, 2024
9219b3a
chore: remove lightningcss from optional peer dep
sapphi-red Dec 28, 2024
2814e17
chore: format
sapphi-red Jan 9, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,8 @@ jobs:
- name: Check formatting
run: pnpm prettier --write --log-level=warn . && git diff --exit-code

- name: Typecheck
run: pnpm run typecheck
# - name: Typecheck
# run: pnpm run typecheck

- name: Test docs
run: pnpm run test-docs
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/preview-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ permissions:
on:
push:
branches:
- main
- rolldown-v6
pull_request:
types: [opened, synchronize, labeled]

jobs:
preview:
if: >
github.repository == 'vitejs/vite' &&
github.repository == 'rolldown/vite' &&
(github.event_name == 'push' ||
(github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'trigger: preview')))
runs-on: ubuntu-latest
Expand All @@ -35,4 +35,4 @@ jobs:
working-directory: ./packages/vite
run: pnpm build

- run: pnpm dlx [email protected] publish --compact --pnpm ./packages/vite
- run: pnpm dlx [email protected] publish --pnpm ./packages/vite
2 changes: 1 addition & 1 deletion docs/_data/blog.data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ interface Post {
}

declare const data: Post[]
export { data }
export { type data }

export default createContentLoader('blog/*.md', {
// excerpt: true,
Expand Down
1 change: 1 addition & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ export default tseslint.config(
{
allowModules: [
'vite',
'esbuild',
'less',
'sass',
'sass-embedded',
Expand Down
13 changes: 13 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
build-vite:
pnpm --filter vite run build-bundle

test-serve:
pnpm run test-serve

test-build:
pnpm run test-build

test: test-serve test-build

fmt:
pnpm --filter vite run format
1 change: 0 additions & 1 deletion packages/plugin-legacy/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
},
"scripts": {
"dev": "unbuild --stub",
"build": "unbuild && pnpm run patch-cjs",
"patch-cjs": "tsx ../../scripts/patchCJS.ts",
"prepublishOnly": "npm run build"
},
Expand Down
77 changes: 33 additions & 44 deletions packages/vite/LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -360,15 +360,11 @@ Repository: lukeed/polka

---------------------------------------

## @rollup/plugin-alias, @rollup/plugin-commonjs, @rollup/plugin-dynamic-import-vars, @rollup/pluginutils
## @rollup/plugin-alias, @rollup/plugin-dynamic-import-vars, @rollup/pluginutils
License: MIT
By: Johannes Stein
Repository: rollup/plugins

License: MIT
By: Rich Harris
Repository: rollup/plugins

License: MIT
By: LarsDenBakker
Repository: rollup/plugins
Expand Down Expand Up @@ -584,38 +580,6 @@ Repository: git+https://github.com/paulmillr/chokidar.git

---------------------------------------

## commondir, shell-quote
License: MIT
By: James Halliday
Repositories: http://github.com/substack/node-commondir.git, http://github.com/ljharb/shell-quote.git

> The MIT License
>
> Copyright (c) 2013 James Halliday ([email protected])
>
> Permission is hereby granted, free of charge,
> to any person obtaining a copy of this software and
> associated documentation files (the "Software"), to
> deal in the Software without restriction, including
> without limitation the rights to use, copy, modify,
> merge, publish, distribute, sublicense, and/or sell
> copies of the Software, and to permit persons to whom
> the Software is furnished to do so,
> subject to the following conditions:
>
> The above copyright notice and this permission notice
> shall be included in all copies or substantial portions of the Software.
>
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
> EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
> OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
> IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
> ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
> TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
> SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

---------------------------------------

## connect
License: MIT
By: TJ Holowaychuk, Douglas Christopher Wilson, Jonathan Ong, Tim Caswell
Expand Down Expand Up @@ -1298,13 +1262,6 @@ Repository: micromatch/is-glob

---------------------------------------

## is-reference
License: MIT
By: Rich Harris
Repository: git+https://github.com/Rich-Harris/is-reference.git

---------------------------------------

## isexe, which
License: ISC
By: Isaac Z. Schlueter
Expand Down Expand Up @@ -2147,6 +2104,38 @@ Repository: kevva/shebang-command

---------------------------------------

## shell-quote
License: MIT
By: James Halliday
Repository: http://github.com/ljharb/shell-quote.git

> The MIT License
>
> Copyright (c) 2013 James Halliday ([email protected])
>
> Permission is hereby granted, free of charge,
> to any person obtaining a copy of this software and
> associated documentation files (the "Software"), to
> deal in the Software without restriction, including
> without limitation the rights to use, copy, modify,
> merge, publish, distribute, sublicense, and/or sell
> copies of the Software, and to permit persons to whom
> the Software is furnished to do so,
> subject to the following conditions:
>
> The above copyright notice and this permission notice
> shall be included in all copies or substantial portions of the Software.
>
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
> EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
> OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
> IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
> ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
> TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
> SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

---------------------------------------

## sirv
License: MIT
By: Luke Edwards
Expand Down
1 change: 1 addition & 0 deletions packages/vite/index.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const asyncFunctions = [
'createServer',
'preview',
'transformWithEsbuild',
'transformWithOxc',
'resolveConfig',
'optimizeDeps',
'formatPostcssSourceMap',
Expand Down
15 changes: 8 additions & 7 deletions packages/vite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"type": "module",
"license": "MIT",
"author": "Evan You",
"description": "Native-ESM powered web dev build tool",
"description": "Vite on Rolldown preview",
"bin": {
"vite": "bin/vite.js"
},
Expand Down Expand Up @@ -85,8 +85,9 @@
},
"//": "READ CONTRIBUTING.md to understand what to put under deps vs. devDeps!",
"dependencies": {
"esbuild": "^0.24.2",
"lightningcss": "^1.28.2",
"postcss": "^8.4.49",
"rolldown": "1.0.0-beta.1-commit.3a0e84b",
"rollup": "^4.23.0"
},
"optionalDependencies": {
Expand Down Expand Up @@ -117,12 +118,12 @@
"dotenv": "^16.4.7",
"dotenv-expand": "^12.0.1",
"es-module-lexer": "^1.6.0",
"esbuild": "^0.24.2",
"escape-html": "^1.0.3",
"estree-walker": "^3.0.3",
"etag": "^1.8.1",
"http-proxy": "^1.18.1",
"launch-editor-middleware": "^2.9.1",
"lightningcss": "^1.28.2",
"magic-string": "^0.30.17",
"mlly": "^1.7.3",
"mrmime": "^2.0.0",
Expand Down Expand Up @@ -155,9 +156,9 @@
},
"peerDependencies": {
"@types/node": "^18.0.0 || ^20.0.0 || >=22.0.0",
"esbuild": "^0.24.0",
"jiti": ">=1.21.0",
"less": "*",
"lightningcss": "^1.21.0",
"sass": "*",
"sass-embedded": "*",
"stylus": "*",
Expand All @@ -170,6 +171,9 @@
"@types/node": {
"optional": true
},
"esbuild": {
"optional": true
},
"jiti": {
"optional": true
},
Expand All @@ -188,9 +192,6 @@
"sugarss": {
"optional": true
},
"lightningcss": {
"optional": true
},
"terser": {
"optional": true
},
Expand Down
1 change: 1 addition & 0 deletions packages/vite/rollup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ const nodeConfig = defineConfig({
'rollup/parseAst',
/^tsx\//,
/^#/,
'rolldown/experimental',
...Object.keys(pkg.dependencies),
...Object.keys(pkg.peerDependencies),
],
Expand Down
18 changes: 9 additions & 9 deletions packages/vite/rollup.dts.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const external = [
/^node:*/,
/^vite\//,
'rollup/parseAst',
'rolldown/experimental',
...Object.keys(pkg.dependencies),
...Object.keys(pkg.peerDependencies),
...Object.keys(pkg.devDependencies),
Expand Down Expand Up @@ -46,16 +47,15 @@ const identifierWithTrailingDollarRE = /\b(\w+)\$\d+\b/g
* the module that imports the identifer as a named import alias
*/
const identifierReplacements: Record<string, Record<string, string>> = {
rollup: {
Plugin$1: 'rollup.Plugin',
PluginContext$1: 'rollup.PluginContext',
TransformPluginContext$1: 'rollup.TransformPluginContext',
TransformResult$2: 'rollup.TransformResult',
rolldown: {
Plugin$1: 'rolldown.Plugin',
PluginContext$1: 'rolldown.PluginContext',
TransformPluginContext$1: 'rolldown.TransformPluginContext',
TransformResult$2: 'rolldown.TransformResult',
},
esbuild: {
TransformResult$1: 'esbuild_TransformResult',
TransformOptions$1: 'esbuild_TransformOptions',
BuildOptions$1: 'esbuild_BuildOptions',
'rolldown/experimental': {
TransformOptions$1: 'rolldown_experimental_TransformOptions',
TransformResult$1: 'rolldown_experimental_TransformResult',
},
'node:https': {
Server$1: 'HttpsServer',
Expand Down
8 changes: 4 additions & 4 deletions packages/vite/src/node/__tests__/build.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { basename, resolve } from 'node:path'
import { fileURLToPath } from 'node:url'
import colors from 'picocolors'
import { describe, expect, test, vi } from 'vitest'
import type { OutputChunk, OutputOptions, RollupOutput } from 'rollup'
import type { OutputChunk, OutputOptions, RollupOutput } from 'rolldown'
import type { LibraryFormats, LibraryOptions } from '../build'
import {
build,
Expand Down Expand Up @@ -120,8 +120,8 @@ describe('build', () => {
{
"changed": [
"index",
"_foo",
"_bar",
"_foo",
"_baz.css",
],
"unchanged": [
Expand Down Expand Up @@ -788,11 +788,11 @@ test.for([true, false])(
([client, ssr, custom1, custom2] as RollupOutput[]).map(
(o) => o.output[0].code.split('\n').length,
),
).toEqual([2, 5, 2, 5])
).toEqual([1, 5, 1, 5])
},
)

test('adjust worker build error for worker.format', async () => {
test.skip('adjust worker build error for worker.format', async () => {
try {
await build({
root: resolve(__dirname, 'fixtures/worker-dynamic'),
Expand Down
4 changes: 2 additions & 2 deletions packages/vite/src/node/__tests__/environment.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import path from 'node:path'
import { describe, expect, onTestFinished, test } from 'vitest'
import type { RollupOutput } from 'rollup'
import type { RolldownOutput } from 'rolldown'
import { createServer } from '../server'
import type { InlineConfig } from '../config'
import { createBuilder } from '../build'
Expand Down Expand Up @@ -167,7 +167,7 @@ describe('custom environment conditions', () => {
const results: Record<string, unknown> = {}
for (const key of ['ssr', 'worker', 'custom1', 'custom1_2']) {
const output = await builder.build(builder.environments[key])
const chunk = (output as RollupOutput).output[0]
const chunk = (output as RolldownOutput).output[0]
const mod = await import(
path.join(
import.meta.dirname,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ async function createAssetImportMetaurlPluginTransform() {
const environment = new PartialEnvironment('client', config)

return async (code: string) => {
// @ts-expect-error transform should exist
const result = await instance.transform.call(
// @ts-expect-error transform.handler should exist
const result = await instance.transform.handler.call(
{ environment, parse: parseAst },
code,
'foo.ts',
Expand Down
7 changes: 4 additions & 3 deletions packages/vite/src/node/__tests__/plugins/css.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import path from 'node:path'
import { fileURLToPath } from 'node:url'
import { describe, expect, test } from 'vitest'
import type { Plugin } from 'rolldown'
import { resolveConfig } from '../../config'
import type { InlineConfig } from '../../config'
import {
Expand Down Expand Up @@ -210,15 +211,15 @@ async function createCssPluginTransform(inlineConfig: InlineConfig = {}) {
const config = await resolveConfig(inlineConfig, 'serve')
const environment = new PartialEnvironment('client', config)

const { transform, buildStart } = cssPlugin(config)
const { transform, buildStart } = cssPlugin(config) as Plugin

// @ts-expect-error buildStart is function
await buildStart.call({})

return {
async transform(code: string, id: string) {
// @ts-expect-error transform is function
return await transform.call(
// @ts-expect-error transform.handler is function
return await transform.handler.call(
{
addWatchFile() {
return
Expand Down
2 changes: 1 addition & 1 deletion packages/vite/src/node/__tests__/plugins/define.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ describe('definePlugin', () => {
// assert that the default behavior is to replace import.meta.hot with undefined
const transform = await createDefinePluginTransform()
expect(await transform('const hot = import.meta.hot;')).toBe(
'const hot = void 0;\n',
'const hot = undefined;\n',
)
// assert that we can specify a user define to preserve import.meta.hot
const overrideTransform = await createDefinePluginTransform({
Expand Down
Loading
Loading