Skip to content

Commit

Permalink
Merge pull request #36 from webaddkevin/fix-20231021
Browse files Browse the repository at this point in the history
fix: add judge before move src/*.html
  • Loading branch information
IndexXuan authored Oct 22, 2023
2 parents 551d723 + f0e255b commit 6115666
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,12 @@ export default function htmlTemplate(userOptions: UserOptions = {}): Plugin {
options.data = rebuildData
}
let config: ResolvedConfig
let command: 'build' | 'serve' = 'build'
return {
name,
config(config, env) {
command = env.command
},
configResolved(resolvedConfig) {
config = resolvedConfig
},
Expand Down Expand Up @@ -148,7 +152,7 @@ export default function htmlTemplate(userOptions: UserOptions = {}): Plugin {
typeof config.build?.rollupOptions.input !== 'string' &&
Object.keys(config.build?.rollupOptions.input || {}).length > 0
// MPA handled by vite-plugin-mpa
if (!isMPA) {
if (!isMPA && command === 'build') {
const root = config.root || process.cwd()
const dest = (config.build && config.build.outDir) || 'dist'
const resolve = (p: string) => path.resolve(root, p)
Expand Down

0 comments on commit 6115666

Please sign in to comment.