Skip to content

Commit

Permalink
fix: normalize internal plugin names (#4976)
Browse files Browse the repository at this point in the history
  • Loading branch information
patak-dev committed Sep 19, 2021
1 parent defefe1 commit 37f0b2f
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
10 changes: 5 additions & 5 deletions packages/plugin-legacy/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ function viteLegacyPlugin(options = {}) {
* @type {import('vite').Plugin}
*/
const legacyConfigPlugin = {
name: 'legacy-config',
name: 'vite:legacy-config',

apply: 'build',
config(config) {
Expand All @@ -93,7 +93,7 @@ function viteLegacyPlugin(options = {}) {
* @type {import('vite').Plugin}
*/
const legacyGenerateBundlePlugin = {
name: 'legacy-generate-polyfill-chunk',
name: 'vite:legacy-generate-polyfill-chunk',
apply: 'build',

configResolved(config) {
Expand Down Expand Up @@ -164,7 +164,7 @@ function viteLegacyPlugin(options = {}) {
* @type {import('vite').Plugin}
*/
const legacyPostPlugin = {
name: 'legacy-post-process',
name: 'vite:legacy-post-process',
enforce: 'post',
apply: 'build',

Expand Down Expand Up @@ -449,7 +449,7 @@ function viteLegacyPlugin(options = {}) {
* @type {import('vite').Plugin}
*/
const legacyEnvPlugin = {
name: 'legacy-env',
name: 'vite:legacy-env',

config(config, env) {
if (env) {
Expand Down Expand Up @@ -584,7 +584,7 @@ const polyfillId = 'vite/legacy-polyfills'
*/
function polyfillsPlugin(imports) {
return {
name: 'polyfills',
name: 'vite:legacy-polyfills',
resolveId(id) {
if (id === polyfillId) {
return id
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-vue-jsx/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ function vueJsxPlugin(options = {}) {
let needSourceMap = true

return {
name: 'vue-jsx',
name: 'vite:vue-jsx',

config(config) {
return {
Expand Down
2 changes: 1 addition & 1 deletion packages/vite/src/node/plugins/assetImportMetaUrl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { multilineCommentsRE, singlelineCommentsRE } from '../utils'
*/
export function assetImportMetaUrlPlugin(config: ResolvedConfig): Plugin {
return {
name: 'asset-import-meta-url',
name: 'vite:asset-import-meta-url',
async transform(code, id, ssr) {
if (code.includes('new URL') && code.includes(`import.meta.url`)) {
const importMetaUrlRE =
Expand Down
5 changes: 4 additions & 1 deletion packages/vite/src/node/plugins/loadFallback.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@ import { promises as fs } from 'fs'
import { Plugin } from '..'
import { cleanUrl } from '../utils'

/**
* A plugin to provide build load fallback for arbitrary request with queries.
*/
export function loadFallbackPlugin(): Plugin {
return {
name: 'load-fallback',
name: 'vite:load-fallback',
async load(id) {
try {
return fs.readFile(cleanUrl(id), 'utf-8')
Expand Down

0 comments on commit 37f0b2f

Please sign in to comment.