diff --git a/.gitignore b/.gitignore index a535e13..e05a664 100644 --- a/.gitignore +++ b/.gitignore @@ -9,4 +9,5 @@ web/dist collectedstatic perpus-env .venv -.env \ No newline at end of file +.env +static \ No newline at end of file diff --git a/perpus/settings.py b/perpus/settings.py index 73b75d0..c33d780 100644 --- a/perpus/settings.py +++ b/perpus/settings.py @@ -186,17 +186,17 @@ # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/4.1/howto/static-files/ -STATIC_URL = '/static/' +STATIC_URL = 'static/' # Where ViteJS assets are built. -DJANGO_VITE_ASSETS_PATH = BASE_DIR / 'web' / 'dist' +DJANGO_VITE_ASSETS_PATH = BASE_DIR / 'static' DJANGO_VITE_DEV_MODE = True if os.environ.get('WEB_ENV') == 'prod': DJANGO_VITE_DEV_MODE = False DJANGO_VITE_DEV_SERVER_PORT = 3000 # Name of static files folder (after called python manage.py collectstatic) -STATIC_ROOT = BASE_DIR +STATIC_ROOT = os.path.join(BASE_DIR, "staticfiles") # Include DJANGO_VITE_ASSETS_PATH into STATICFILES_DIRS to be copied inside # when run command python manage.py collectstatic diff --git a/vite.config.js b/vite.config.js index e21890c..495baf8 100644 --- a/vite.config.js +++ b/vite.config.js @@ -19,13 +19,12 @@ export default defineConfig({ }, }, resolve: { - extensions: ['.js', '.jsx', '.json', '.svelte'], + extensions: ['.js', '.json', '.svelte'], }, build: { - outDir: resolve('./web/dist'), + outDir: resolve('./static'), assetsDir: '', - manifest: 'manifest.json', - emptyOutDir: true, + manifest: true, target: 'es2015', rollupOptions: { input: {