File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44 Referrer-Policy: strict-origin-when-cross-origin
55 Permissions-Policy: camera=(), microphone=(), geolocation=()
66 Content-Security-Policy: default-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; img-src 'self' data: https:; font-src 'self' data:; connect-src 'self' https:; frame-ancestors 'none'
7+ Cache-Control: no-cache, no-store, must-revalidate
8+ Pragma: no-cache
9+ Expires: 0
10+
11+ /assets/*
12+ Cache-Control: public, max-age=31536000, immutable
713
814/.well-known/*
915 Access-Control-Allow-Origin: *
Original file line number Diff line number Diff line change 2828 < link rel ="preconnect " href ="https://fonts.gstatic.com " crossorigin />
2929 < link href ="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=JetBrains+Mono:wght@400;500;600;700&display=swap " rel ="stylesheet " />
3030 < title > QECTOR · Production-Grade Quantum Error Correction Decoding for Python</ title >
31- < script type ="module " crossorigin src ="/assets/index-CaGUdrOG.js "> </ script >
31+ < script type ="module " data-cfasync =" false " crossorigin src ="/assets/index-CaGUdrOG.js "> </ script >
3232 < link rel ="stylesheet " crossorigin href ="/assets/index-B4eLQ2k1.css ">
3333 </ head >
3434 < body >
Original file line number Diff line number Diff line change 44 Referrer-Policy: strict-origin-when-cross-origin
55 Permissions-Policy: camera=(), microphone=(), geolocation=()
66 Content-Security-Policy: default-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; img-src 'self' data: https:; font-src 'self' data:; connect-src 'self' https:; frame-ancestors 'none'
7+ Cache-Control: no-cache, no-store, must-revalidate
8+ Pragma: no-cache
9+ Expires: 0
10+
11+ /assets/*
12+ Cache-Control: public, max-age=31536000, immutable
713
814/.well-known/*
915 Access-Control-Allow-Origin: *
Original file line number Diff line number Diff line change @@ -4,13 +4,27 @@ import { defineConfig } from "vite"
44import { inspectAttr } from 'kimi-plugin-inspect-react'
55
66// https://vite.dev/config/
7+ // Cloudflare Rocket Loader rewrites <script type="module"> to
8+ // <script type="<random>-module">, breaking ESM and causing the browser to
9+ // download files instead. The data-cfasync="false" attribute tells Cloudflare
10+ // to skip Rocket Loader for that tag.
11+ function cfRocketBypass ( ) : import ( 'vite' ) . Plugin {
12+ return {
13+ name : 'cf-rocket-bypass' ,
14+ enforce : 'post' ,
15+ transformIndexHtml ( html ) {
16+ return html . replace ( / ( < s c r i p t \s + t y p e = " m o d u l e " ) / g, '$1 data-cfasync="false"' )
17+ } ,
18+ }
19+ }
20+
721export default defineConfig ( ( { command } ) => ( {
822 base : '/' ,
923 // inspectAttr() tags every JSX element with source file/line data attributes.
1024 // Useful in the editor while developing, but it has no business shipping to
1125 // production: it bloats the bundle and leaks internal file paths into the
1226 // live HTML. Only include it when Vite is running the dev server.
13- plugins : [ ...( command === 'serve' ? [ inspectAttr ( ) ] : [ ] ) , react ( ) ] ,
27+ plugins : [ ...( command === 'serve' ? [ inspectAttr ( ) ] : [ ] ) , cfRocketBypass ( ) , react ( ) ] ,
1428 server : {
1529 port : 3000 ,
1630 } ,
You can’t perform that action at this time.
0 commit comments