Skip to content

Commit

Permalink
🐛 fix(custom): dev环境下路径问题
Browse files Browse the repository at this point in the history
ISSUES CLOSED: #19
  • Loading branch information
master1lan committed Feb 19, 2023
1 parent bba1183 commit ba34908
Showing 1 changed file with 23 additions and 16 deletions.
39 changes: 23 additions & 16 deletions config/vite.master.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { defineConfig } from "vite";
import { defineConfig, UserConfigExport } from "vite";
// 可视化打包文件
import { visualizer } from "rollup-plugin-visualizer";

Expand Down Expand Up @@ -35,8 +35,28 @@ import { createHtmlPlugin } from "vite-plugin-html";
import { mergeConfig } from "vite";
import vitedevConfig from "./vite.dev.config";
// https://vitejs.dev/config/
//@ts-ignore

export const commonBuildConfig: UserConfigExport = mergeConfig(
defineConfig({
plugins: [
createHtmlPlugin({
entry: "src/main.tsx",
template: "index.html",
inject: {
data: {
injectScript: ProdinjectScript,
},
},
}),
//@ts-ignore
getBulidTime(),
],
}),
vitedevConfig
);

export default mergeConfig(
commonBuildConfig,
defineConfig({
define: {
isdev: false,
Expand All @@ -49,19 +69,7 @@ export default mergeConfig(
"iOS >= 9, Android >= 4.4, last 2 versions, > 0.2%, not dead",
],
}),
{ ...visualizer(), apply: "build" },
{ ...viteCompression(), apply: "build" },
createHtmlPlugin({
entry: "src/main.tsx",
template: "index.html",
inject: {
data: {
injectScript: ProdinjectScript,
},
},
}),
//@ts-ignore
getBulidTime(),
],
build: {
sourcemap: true,
Expand Down Expand Up @@ -100,6 +108,5 @@ export default mergeConfig(
},
},
},
}),
vitedevConfig
})
);

0 comments on commit ba34908

Please sign in to comment.