Skip to content

Commit

Permalink
chore: rename plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
hi-ogawa committed Sep 29, 2024
1 parent 0a75e0e commit 7108262
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
8 changes: 6 additions & 2 deletions examples/web-worker-rsc/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
import react from "@vitejs/plugin-react";
import { defineConfig } from "vite";
import { vitePluginWorkerRunner } from "../web-worker/vite.config";
import { vitePluginWorkerEnvironment } from "../web-worker/vite.config";
import { vitePluginFetchModuleServer } from "./src/lib/fetch-module-server";

export default defineConfig((_env) => ({
clearScreen: false,
plugins: [react(), vitePluginWorkerRunner(), vitePluginFetchModuleServer()],
plugins: [
react(),
vitePluginWorkerEnvironment(),
vitePluginFetchModuleServer(),
],
environments: {
client: {
dev: {
Expand Down
12 changes: 8 additions & 4 deletions examples/web-worker/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ import { vitePluginFetchModuleServer } from "./src/lib/fetch-module-server";

export default defineConfig((_env) => ({
clearScreen: false,
plugins: [react(), vitePluginWorkerRunner(), vitePluginFetchModuleServer()],
plugins: [
react(),
vitePluginWorkerEnvironment(),
vitePluginFetchModuleServer(),
],
environments: {
client: {
dev: {
Expand Down Expand Up @@ -76,9 +80,9 @@ const manager = new (class PluginStateManager {
workerMap: Record<string, { referenceId?: string; fileName?: string }> = {};
})();

export function vitePluginWorkerRunner(): Plugin[] {
export function vitePluginWorkerEnvironment(): Plugin[] {
const workerImportPlugin: Plugin = {
name: vitePluginWorkerRunner.name + ":import",
name: vitePluginWorkerEnvironment.name + ":import",
sharedDuringBuild: true,
transform(_code, id) {
// rewrite ?worker-env import
Expand Down Expand Up @@ -145,7 +149,7 @@ export function vitePluginWorkerRunner(): Plugin[] {
};

const workerBuildPlugin: Plugin = {
name: vitePluginWorkerRunner.name + ":build",
name: vitePluginWorkerEnvironment.name + ":build",
applyToEnvironment: (env) => env.mode === "build" && env.name === "worker",
sharedDuringBuild: true,
buildStart() {
Expand Down

0 comments on commit 7108262

Please sign in to comment.