diff --git a/src/index.ts b/src/index.ts index ff4ba25..fd3ddba 100644 --- a/src/index.ts +++ b/src/index.ts @@ -74,7 +74,11 @@ export default function vitePluginCesium(options: VitePluginCesiumOptions = {}): configureServer({ middlewares }) { const cesiumPath = path.join(cesiumBuildRootPath, devMinifyCesium ? 'Cesium' : 'CesiumUnminified'); - middlewares.use(path.posix.join('/', CESIUM_BASE_URL), serveStatic(cesiumPath)); + middlewares.use(path.posix.join('/', CESIUM_BASE_URL), serveStatic(cesiumPath, { + setHeaders: (res, path, stat) => { + res.setHeader('Access-Control-Allow-Origin', '*') + } + })); }, async closeBundle() {