Skip to content

Commit

Permalink
fix(vite): Remove Vite production use warnings (#8266)
Browse files Browse the repository at this point in the history
  • Loading branch information
markdalgleish authored Dec 12, 2023
1 parent 97bd602 commit 19d7f83
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 30 deletions.
5 changes: 0 additions & 5 deletions docs/future/vite.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@ title: Vite (Unstable)

# Vite (Unstable)

<docs-warning>
Vite support is currently unstable and only intended to gather early feedback.
We don't yet recommend using this in production.
</docs-warning>

[Vite][vite] is a powerful, performant and extensible development environment for JavaScript projects. In order to improve and extend Remix's bundling capabilities, we're currently exploring the use of Vite as an alternative compiler to esbuild.

**Legend**: ✅ (Tested),❓ (Untested), ⏳ (Not Yet Supported)
Expand Down
30 changes: 5 additions & 25 deletions packages/remix-dev/vite/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -276,16 +276,6 @@ const getRouteModuleExports = async (
return exportNames;
};

const showUnstableWarning = () => {
console.warn(
colors.yellow(
colors.bold(
"\n ⚠️ Remix support for Vite is unstable and\n not yet recommended for production\n"
)
)
);
};

const getViteMajorVersion = (): number => {
let vitePkg = require("vite/package.json");
return parseInt(vitePkg.version.split(".")[0]!);
Expand Down Expand Up @@ -723,14 +713,6 @@ export const remixVitePlugin: RemixVitePlugin = (options = {}) => {
buildStart() {
invariant(viteConfig);

if (
viteCommand === "build" &&
// Only show warning on initial client build
!viteConfig.build.ssr
) {
showUnstableWarning();
}

if (
viteCommand === "build" &&
viteConfig.mode === "production" &&
Expand All @@ -739,26 +721,24 @@ export const remixVitePlugin: RemixVitePlugin = (options = {}) => {
) {
viteConfig.logger.warn(
colors.yellow(
colors.bold(" ⚠️ Source maps are enabled in production\n") +
"\n" +
colors.bold(" ⚠️ Source maps are enabled in production\n") +
[
"This makes your server code publicly",
"visible in the browser. This is highly",
"discouraged! If you insist, ensure that",
"you are using environment variables for",
"secrets and not hard-coding them in",
"your source code.\n",
"your source code.",
]
.map((line) => " " + line)
.join("\n")
.join("\n") +
"\n"
)
);
}
},
configureServer(viteDevServer) {
viteDevServer.httpServer?.on("listening", () => {
setTimeout(showUnstableWarning, 50);
});

setDevServerHooks({
// Give the request handler access to the critical CSS in dev to avoid a
// flash of unstyled content since Vite injects CSS file contents via JS
Expand Down

0 comments on commit 19d7f83

Please sign in to comment.