Skip to content

Commit f61d065

Browse files
authored
feat!: migrate to ESM (#8178)
1 parent f0b578b commit f61d065

File tree

6 files changed

+11
-4
lines changed

6 files changed

+11
-4
lines changed

.eslintrc.cjs

+6
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,12 @@ module.exports = defineConfig({
148148
rules: {
149149
'@typescript-eslint/triple-slash-reference': 'off'
150150
}
151+
},
152+
{
153+
files: 'packages/vite/**/*.*',
154+
rules: {
155+
'no-restricted-globals': ['error', 'require', '__dirname', '__filename']
156+
}
151157
}
152158
]
153159
})

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@
7777
"prompts": "^2.4.2",
7878
"rimraf": "^3.0.2",
7979
"rollup": "^2.72.1",
80+
"rollup-plugin-esbuild": "^4.9.1",
8081
"semver": "^7.3.7",
8182
"simple-git-hooks": "^2.7.0",
8283
"sirv": "^2.0.2",

packages/plugin-vue-jsx/src/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { createHash } from 'crypto'
22
import path from 'path'
33
import type { types } from '@babel/core'
4-
import babel from '@babel/core'
4+
import * as babel from '@babel/core'
55
import jsx from '@vue/babel-plugin-jsx'
66
// @ts-expect-error missing type
77
import importMeta from '@babel/plugin-syntax-import-meta'

packages/plugin-vue/src/style.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export async function transformStyle(
5151
}
5252

5353
const map = result.map
54-
? formatPostcssSourceMap(
54+
? await formatPostcssSourceMap(
5555
// version property of result.map is declared as string
5656
// but actually it is a number
5757
result.map as Omit<RawSourceMap, 'version'> as ExistingRawSourceMap,

playground/vitestSetup.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ export async function startDefaultServe() {
161161
let config: InlineConfig | undefined
162162
if (fs.existsSync(testCustomConfig)) {
163163
// test has custom server configuration.
164-
config = require(testCustomConfig)
164+
config = await import(testCustomConfig).then((r) => r.default)
165165
}
166166

167167
const options: InlineConfig = {

playground/vue-sourcemap/__tests__/serve.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ describe.runIf(isServe)('serve:vue-sourcemap', () => {
1515
return text
1616
}
1717
}
18-
throw new Error('Not found')
18+
throw new Error('Style not found: ' + content)
1919
}
2020

2121
test('js', async () => {

0 commit comments

Comments
 (0)