Skip to content
This repository has been archived by the owner on Jul 20, 2022. It is now read-only.

Commit

Permalink
prevent vite from replacing NODE_ENV
Browse files Browse the repository at this point in the history
  • Loading branch information
xstevenyung committed Feb 7, 2022
1 parent 7ac7b9c commit 551f559
Showing 1 changed file with 29 additions and 23 deletions.
52 changes: 29 additions & 23 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,36 @@ import react from "@vitejs/plugin-react";
import path from "path";

// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()],
build: {
emptyOutDir: false,
lib: {
entry: path.resolve(__dirname, "src/index.ts"),
name: "RemixCrash",
fileName: (format) => `remix-crash.${format}.js`,
},
rollupOptions: {
// make sure to externalize deps that shouldn't be bundled
// into your library
external: ["react", "react-dom", "remix", "source-map", "fs/promises"],
output: {
// Provide global variables to use in the UMD build
// for externalized deps
globals: {
react: "React",
"react-dom": "ReactDOM",
remix: "Remix",
"source-map": "SourceMap",
"fs/promises": "FSPromises",
export default defineConfig(({ mode }) => {
return {
plugins: [react()],
define:
mode === "production"
? { "process.env.NODE_ENV": "process.env.NODE_ENV" }
: {},
build: {
emptyOutDir: false,
lib: {
entry: path.resolve(__dirname, "src/index.ts"),
name: "RemixCrash",
fileName: (format) => `remix-crash.${format}.js`,
},
rollupOptions: {
// make sure to externalize deps that shouldn't be bundled
// into your library
external: ["react", "react-dom", "remix", "source-map", "fs/promises"],
output: {
// Provide global variables to use in the UMD build
// for externalized deps
globals: {
react: "React",
"react-dom": "ReactDOM",
remix: "Remix",
"source-map": "SourceMap",
"fs/promises": "FSPromises",
},
},
},
},
},
};
});

0 comments on commit 551f559

Please sign in to comment.