From fa72eb1d00a56360667a9ae50b738938da87a906 Mon Sep 17 00:00:00 2001 From: sapphi-red Date: Sat, 24 Sep 2022 23:19:44 +0900 Subject: [PATCH] refactor(vue-jsx): remove @babel/plugin-syntax-import-meta --- packages/plugin-vue-jsx/package.json | 1 - packages/plugin-vue-jsx/src/index.ts | 4 +--- pnpm-lock.yaml | 16 ---------------- 3 files changed, 1 insertion(+), 20 deletions(-) diff --git a/packages/plugin-vue-jsx/package.json b/packages/plugin-vue-jsx/package.json index 7c61ff0fab5a27..68567ec2abb5bc 100644 --- a/packages/plugin-vue-jsx/package.json +++ b/packages/plugin-vue-jsx/package.json @@ -36,7 +36,6 @@ "homepage": "https://github.com/vitejs/vite/tree/main/packages/plugin-vue-jsx#readme", "dependencies": { "@babel/core": "^7.19.1", - "@babel/plugin-syntax-import-meta": "^7.10.4", "@babel/plugin-transform-typescript": "^7.19.1", "@vue/babel-plugin-jsx": "^1.1.1" }, diff --git a/packages/plugin-vue-jsx/src/index.ts b/packages/plugin-vue-jsx/src/index.ts index e5454980ed4d8e..cb2888728a45b5 100644 --- a/packages/plugin-vue-jsx/src/index.ts +++ b/packages/plugin-vue-jsx/src/index.ts @@ -3,8 +3,6 @@ import path from 'node:path' import type { types } from '@babel/core' import * as babel from '@babel/core' import jsx from '@vue/babel-plugin-jsx' -// @ts-expect-error missing type -import importMeta from '@babel/plugin-syntax-import-meta' import { createFilter, normalizePath } from 'vite' import type { ComponentOptions } from 'vue' import type { Plugin } from 'vite' @@ -83,7 +81,7 @@ function vueJsxPlugin(options: Options = {}): Plugin { // use id for script blocks in Vue SFCs (e.g. `App.vue?vue&type=script&lang.jsx`) // use filepath for plain jsx files (e.g. App.jsx) if (filter(id) || filter(filepath)) { - const plugins = [importMeta, [jsx, babelPluginOptions], ...babelPlugins] + const plugins = [[jsx, babelPluginOptions], ...babelPlugins] if (id.endsWith('.tsx') || filepath.endsWith('.tsx')) { plugins.push([ // @ts-ignore missing type diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 3eeeda1cd37e39..1b568ad3bf898b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -199,13 +199,11 @@ importers: packages/plugin-vue-jsx: specifiers: '@babel/core': ^7.19.1 - '@babel/plugin-syntax-import-meta': ^7.10.4 '@babel/plugin-transform-typescript': ^7.19.1 '@vue/babel-plugin-jsx': ^1.1.1 vite: workspace:* dependencies: '@babel/core': 7.19.1 - '@babel/plugin-syntax-import-meta': 7.10.4_@babel+core@7.19.1 '@babel/plugin-transform-typescript': 7.19.1_@babel+core@7.19.1 '@vue/babel-plugin-jsx': 1.1.1_@babel+core@7.19.1 devDependencies: @@ -1526,11 +1524,6 @@ packages: '@babel/types': 7.19.0 dev: false - /@babel/helper-plugin-utils/7.16.7: - resolution: {integrity: sha512-Qg3Nk7ZxpgMrsox6HreY1ZNKdBq7K72tDSliA6dCl5f007jR4ne8iD5UzuNnCJH2xBf2BEEVGr+/OL6Gdp7RxA==} - engines: {node: '>=6.9.0'} - dev: false - /@babel/helper-plugin-utils/7.18.6: resolution: {integrity: sha512-gvZnm1YAAxh13eJdkb9EWHBnF3eAub3XTLCZEehHT2kWxiKVRL64+ae5Y6Ivne0mVHmMYKT+xWgZO+gQhuLUBg==} engines: {node: '>=6.9.0'} @@ -1617,15 +1610,6 @@ packages: '@babel/plugin-syntax-pipeline-operator': 7.18.6 dev: true - /@babel/plugin-syntax-import-meta/7.10.4_@babel+core@7.19.1: - resolution: {integrity: sha512-Yqfm+XDx0+Prh3VSeEQCPU81yC+JWZ2pDPFSS4ZdpfZhp4MkFMaDC1UqseovEKwSUpnIL7+vK+Clp7bfh0iD7g==} - peerDependencies: - '@babel/core': ^7.0.0-0 - dependencies: - '@babel/core': 7.19.1 - '@babel/helper-plugin-utils': 7.16.7 - dev: false - /@babel/plugin-syntax-jsx/7.16.7_@babel+core@7.19.1: resolution: {integrity: sha512-Esxmk7YjA8QysKeT3VhTXvF6y77f/a91SIs4pWb4H2eWGQkCKFgQaG6hdoEVZtGsrAcb2K5BW66XsOErD4WU3Q==} engines: {node: '>=6.9.0'}