Home
About
Blog
Products
Forum
Support
Contact
Sunbelt Computer Software
PL/B Language Development and Support
Home
About
Blog
Products
Forum
Support
Contact
bashnota/vite.config.ts at master · bashnota/bashnota · GitHub
Skip to content
Navigation Menu
Sign in
Appearance settings
Platform
AI CODE CREATION
GitHub Copilot
Write better code with AI
GitHub Copilot app
Direct agents from issue to merge
MCP Registry
Integrate external tools
DEVELOPER WORKFLOWS
Actions
Automate any workflow
Codespaces
Instant dev environments
Issues
Plan and track work
Code Review
Manage code changes
Code Quality
Enforce quality at merge
APPLICATION SECURITY
GitHub Advanced Security
Find and fix vulnerabilities
Code security
Secure your code as you build
Secret protection
Stop leaks before they start
EXPLORE
Why GitHub
Documentation
Blog
Changelog
Marketplace
View all features
Solutions
BY COMPANY SIZE
Enterprises
Small and medium teams
Startups
Nonprofits
BY USE CASE
App Modernization
DevSecOps
DevOps
CI/CD
View all use cases
BY INDUSTRY
Healthcare
Financial services
Manufacturing
Government
See all industries
View all solutions
Resources
EXPLORE BY TOPIC
AI
Software Development
DevOps
Security
View all topics
EXPLORE BY TYPE
Customer stories
Events & webinars
Ebooks & reports
Business insights
GitHub Skills
SUPPORT & SERVICES
Documentation
Customer support
Community forum
Trust center
Partners
View all resources
Open Source
COMMUNITY
GitHub Sponsors
Fund open source developers
PROGRAMS
Security Lab
Maintainer Community
GitHub Stars
Archive Program
REPOSITORIES
Topics
Trending
Collections
Enterprise
ENTERPRISE SOLUTIONS
Enterprise platform
AI-powered developer platform
AVAILABLE ADD-ONS
GitHub Advanced Security
Enterprise-grade security features
Copilot for Business
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
Pricing
Search
/
Sign in
Sign up
Appearance settings
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
bashnota
bashnota
Repository navigation
Code
Issues
71
(71)
Pull requests
5
(5)
Discussions
Actions
Projects
Security and quality
Insights
More
items
Files
Expand file tree
master
Breadcrumbs
bashnota
/
vite.config.ts
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
178 lines (174 loc) · 6.6 KB
master
Breadcrumbs
bashnota
/
vite.config.ts
Copy path
Top
File metadata and controls
Code
Blame
178 lines (174 loc) · 6.6 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
import
{
fileURLToPath
,
URL
}
from
'node:url'
import
{
copyFile
,
readFile
}
from
'node:fs/promises'
import
{
join
}
from
'node:path'
import
{
defineConfig
}
from
'vite'
import
vue
from
'@vitejs/plugin-vue'
import
vueJsx
from
'@vitejs/plugin-vue-jsx'
import
vueDevTools
from
'vite-plugin-vue-devtools'
import
{
VitePWA
}
from
'vite-plugin-pwa'
import
{
visualizer
}
from
'rollup-plugin-visualizer'
import
autoprefixer
from
'autoprefixer'
import
tailwind
from
'tailwindcss'
import
{
isSameOriginDeferredAssetRequest
}
from
'./src/pwa/deferredAssetPolicy'
import
{
resolveDeploymentBase
}
from
'./vite.deployment-base'
const
deploymentBase
=
resolveDeploymentBase
(
process
.
env
.
VITE_DEPLOY_BASE
)
/**
* GitHub Pages only serves files and otherwise responds with `404.html`. Keep a
* copy of Vite's generated shell at that path so history-mode Vue routes can
* boot directly without rewriting the visitor's URL.
*/
function
githubPagesSpaFallback
(
)
{
return
{
name
:
'github-pages-spa-fallback'
,
async
writeBundle
(
outputOptions
:
{
dir
?:
string
}
)
{
const
outputDirectory
=
outputOptions
.
dir
??
'dist'
await
copyFile
(
join
(
outputDirectory
,
'index.html'
)
,
join
(
outputDirectory
,
'404.html'
)
)
}
,
}
}
// https://vite.dev/config/
export
default
defineConfig
(
{
base
:
deploymentBase
,
css
:
{
postcss
:
{
plugins
:
[
tailwind
(
)
,
autoprefixer
(
)
]
,
}
,
}
,
plugins
:
[
vue
(
)
,
vueJsx
(
)
,
vueDevTools
(
)
,
githubPagesSpaFallback
(
)
,
VitePWA
(
{
registerType
:
'autoUpdate'
,
includeAssets
:
[
'icons/*.svg'
,
'robots.txt'
]
,
manifest
:
{
name
:
'BashNota'
,
short_name
:
'BashNota'
,
description
:
'Offline-first notebook with Jupyter integration'
,
theme_color
:
'#ffffff'
,
icons
:
[
{
src
:
'icons/app-icon.svg'
,
sizes
:
'any'
,
type
:
'image/svg+xml'
,
purpose
:
'any maskable'
,
}
,
]
,
}
,
workbox
:
{
maximumFileSizeToCacheInBytes
:
10
*
1024
*
1024
,
// 10MB
cleanupOutdatedCaches
:
true
,
skipWaiting
:
true
,
clientsClaim
:
true
,
// Fonts are part of the application shell, not an optional online
// enhancement. Include the self-hosted font files so typography stays
// identical when BashNota is launched offline.
globPatterns
:
[
'**/*.{js,css,html,woff,woff2}'
]
,
// Feature payloads are deliberately absent from the install-time
// precache. Cache them only after the user opens the editor/reader (or
// selects WebLLM), which preserves repeat/offline use without making a
// Home/Login/Public visit download several megabytes in the background.
globIgnores
:
[
'**/webllm-*.js'
,
'**/editor-*.js'
,
'**/d3-chart-*.js'
,
'**/katex-*.js'
,
'**/vue-flow-*.js'
,
'**/heavy-style-*.css'
,
'**/EditorAppShell-*.css'
,
'**/KaTeX_*.*'
,
]
,
// Vite can combine editor/package CSS into a hash-only `index-*.css`
// asset. Preserve only stylesheets referenced by the HTML shell in the
// install manifest; every lazy-route stylesheet is runtime cached.
manifestTransforms
:
[
async
(
entries
)
=>
{
const
shell
=
await
readFile
(
join
(
process
.
cwd
(
)
,
'dist'
,
'index.html'
)
,
'utf8'
)
const
shellStyles
=
new
Set
(
[
...
shell
.
matchAll
(
/
h
r
e
f
=
[
"
'
]
(
[
^
"
'
]
+
\.
c
s
s
)
[
"
'
]
/
g
)
]
.
map
(
(
match
)
=>
match
[
1
]
)
.
filter
(
(
href
)
=>
href
.
startsWith
(
deploymentBase
)
)
.
map
(
(
href
)
=>
href
.
slice
(
deploymentBase
.
length
)
)
,
)
return
{
manifest
:
entries
.
filter
(
(
entry
)
=>
!
entry
.
url
.
endsWith
(
'.css'
)
||
shellStyles
.
has
(
entry
.
url
)
)
,
warnings
:
[
]
,
}
}
]
,
runtimeCaching
:
[
{
urlPattern
:
isSameOriginDeferredAssetRequest
,
handler
:
'CacheFirst'
,
options
:
{
cacheName
:
'bashnota-deferred-features'
,
cacheableResponse
:
{
statuses
:
[
200
]
}
,
expiration
:
{
maxEntries
:
160
,
maxAgeSeconds
:
30
*
24
*
60
*
60
}
,
}
,
}
]
,
}
,
}
)
,
process
.
env
.
BUNDLE_ANALYZE
===
'1'
&&
visualizer
(
{
filename
:
'reports/bundle-visualizer.html'
,
template
:
'treemap'
,
gzipSize
:
true
,
brotliSize
:
true
,
open
:
false
,
}
)
,
]
,
server
:
{
proxy
:
{
'/jupyter'
:
{
target
:
'http://localhost:8888'
,
changeOrigin
:
true
,
rewrite
:
(
path
)
=>
path
.
replace
(
/
^
\/
j
u
p
y
t
e
r
/
,
''
)
,
configure
:
(
proxy
)
=>
{
proxy
.
on
(
'error'
,
(
err
)
=>
{
console
.
log
(
'proxy error'
,
err
)
}
)
proxy
.
on
(
'proxyReq'
,
(
proxyReq
,
req
)
=>
{
if
(
req
.
headers
.
authorization
)
{
proxyReq
.
setHeader
(
'Authorization'
,
req
.
headers
.
authorization
)
}
}
)
}
,
}
,
}
,
}
,
resolve
:
{
alias
:
{
'@'
:
fileURLToPath
(
new
URL
(
'./src'
,
import
.
meta
.
url
)
)
,
}
,
}
,
build
:
{
// Route chunks fetch their own dependencies once a route is selected. This
// prevents Vite from promoting every dependency of a lazy editor route to
// a document-level modulepreload, while preserving normal dynamic-import
// loading and PWA caching semantics.
modulePreload
:
false
,
rollupOptions
:
{
output
:
{
// Keep dependency preloads with their lazy import boundary. The default
// transitive hoisting turns the editor's manual chunks into entry-module
// imports, which defeats route-level loading even when the component
// itself is a dynamic import.
hoistTransitiveImports
:
false
,
chunkFileNames
(
chunk
)
{
const
moduleIds
=
chunk
.
moduleIds
.
join
(
'\n'
)
if
(
moduleIds
.
includes
(
'/node_modules/@vue-flow/'
)
)
return
'assets/vue-flow-[hash].js'
if
(
moduleIds
.
includes
(
'/node_modules/katex/'
)
)
return
'assets/katex-[hash].js'
if
(
/
\/
n
o
d
e
_
m
o
d
u
l
e
s
\/
(?:
d
3
(?:
-
|
\/
)
|
c
h
a
r
t
\.
j
s
|
v
u
e
-
c
h
a
r
t
j
s
)
/
.
test
(
moduleIds
)
)
return
'assets/d3-chart-[hash].js'
if
(
/
\/
(?:
s
r
c
\/
f
e
a
t
u
r
e
s
\/
e
d
i
t
o
r
|
n
o
d
e
_
m
o
d
u
l
e
s
\/
(?:
@
t
i
p
t
a
p
|
p
r
o
s
e
m
i
r
r
o
r
-
|
@
c
o
d
e
m
i
r
r
o
r
|
@
l
e
z
e
r
|
h
i
g
h
l
i
g
h
t
\.
j
s
|
l
o
w
l
i
g
h
t
|
t
i
p
p
y
\.
j
s
)
)
\/
/
.
test
(
moduleIds
)
)
{
return
'assets/editor-[hash].js'
}
return
'assets/[name]-[hash].js'
}
,
// Keep WebLLM's opt-in runtime independently named. Other editor
// dependencies rely on Vite's route-aware automatic splitting: this
// Vite/Rollup version hoists the transitive dependencies of manually
// named groups into the app entry.
manualChunks
(
id
)
{
if
(
id
.
includes
(
'/node_modules/@mlc-ai/'
)
)
return
'webllm'
}
,
}
,
}
,
}
,
}
)
You can’t perform that action at this time.