vite: add back path.resolve to make build command work

although vite dev works without it
This commit is contained in:
Reorx 2023-02-09 00:03:35 +08:00
parent 357245d234
commit 3e6c9c2299
2 changed files with 8 additions and 7 deletions

View File

@ -1,3 +1,4 @@
import { resolve } from 'path';
import { defineConfig } from 'vite';
import { ViteEjsPlugin } from 'vite-plugin-ejs';
import { viteSingleFile } from 'vite-plugin-singlefile';
@ -31,7 +32,7 @@ export default defineConfig({
{
ejs: (viteConfig) => ({
// ejs options goes here.
views: [__dirname],
views: [resolve(__dirname)],
})
}
),

View File

@ -1,7 +1,10 @@
import { resolve } from 'path';
import { defineConfig } from 'vite';
import { TransformEjs } from './src/lib/vite-plugins';
const rootDir = resolve(__dirname, 'src')
export default defineConfig({
root: 'src',
build: {
@ -9,12 +12,9 @@ export default defineConfig({
target: 'esnext',
rollupOptions: {
input: {
main: 'index.html',
editor: 'editor/index.html',
preview: 'preview/index.html',
// main: resolve(rootDir, 'index.html'),
// editor: resolve(rootDir, 'editor/index.html'),
// editorPreview: resolve(rootDir, 'editor/preview.html'),
main: resolve(rootDir, 'index.html'),
editor: resolve(rootDir, 'editor/index.html'),
preview: resolve(rootDir, 'preview/index.html'),
},
},
},