Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AlekSIS-Core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
AlekSIS®
Official
AlekSIS-Core
Merge requests
!1132
Resolve "Evaluate use of Vite instead of Webpack"
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Resolve "Evaluate use of Vite instead of Webpack"
769-evaluate-use-of-vite-instead-of-webpack
into
master
Overview
0
Commits
13
Pipelines
6
Changes
3
Merged
Nik | Klampfradler
requested to merge
769-evaluate-use-of-vite-instead-of-webpack
into
master
2 years ago
Overview
0
Commits
13
Pipelines
6
Changes
3
Expand
Closes
#769 (closed)
Happy Christmas,
@hansegucker
!
Edited
2 years ago
by
Nik | Klampfradler
0
0
Merge request reports
Viewing commit
d81dfc30
Prev
Next
Show latest version
3 files
+
45
−
19
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
3
Search (e.g. *.vue) (Ctrl+P)
Verified
d81dfc30
Refactor vite call out into utility function
· d81dfc30
Nik | Klampfradler
authored
2 years ago
aleksis/core/management/commands/vite_bundle.py
+
4
−
19
Options
import
json
import
os
import
shutil
from
django.conf
import
settings
from
django_yarnpkg.management.base
import
BaseYarnCommand
from
django_yarnpkg.yarn
import
yarn_adapter
from
...util.frontend_helpers
import
get_apps_with_asset
s
from
...util.frontend_helpers
import
run_vite
,
write_vite_value
s
class
Command
(
BaseYarnCommand
):
@@ -17,23 +15,10 @@ class Command(BaseYarnCommand):
super
(
Command
,
self
).
handle
(
*
args
,
**
options
)
# Inject settings into Vite
vite_values
=
{
"
static_url
"
:
settings
.
STATIC_URL
,
}
# Write rollup entrypoints for all apps
vite_values
[
"
entrypoints
"
]
=
{
app
:
os
.
path
.
join
(
path
,
"
index
"
)
for
app
,
path
in
get_apps_with_assets
().
items
()
}
vite_values
[
"
entrypoints
"
][
"
core
"
]
=
os
.
path
.
join
(
settings
.
BASE_DIR
,
"
aleksis
"
,
"
core
"
,
"
assets
"
,
"
index
"
)
with
open
(
os
.
path
.
join
(
settings
.
NODE_MODULES_ROOT
,
"
django-vite-values.json
"
),
"
w
"
)
as
out
:
json
.
dump
(
vite_values
,
out
)
write_vite_values
(
os
.
path
.
join
(
settings
.
NODE_MODULES_ROOT
,
"
django-vite-values.json
"
))
# Install Node dependencies
yarn_adapter
.
install
(
settings
.
YARN_INSTALLED_APPS
)
# Run Vite
config_path
=
os
.
path
.
join
(
settings
.
BASE_DIR
,
"
aleksis
"
,
"
core
"
,
"
vite.config.js
"
)
shutil
.
copy
(
config_path
,
settings
.
NODE_MODULES_ROOT
)
mode
=
"
development
"
if
settings
.
DEBUG
else
"
production
"
yarn_adapter
.
call_yarn
([
"
run
"
,
"
vite
"
,
"
build
"
,
"
-m
"
,
mode
])
# Run Vite build
run_vite
([
"
build
"
])
Loading