This commit is contained in:
小冰cc 2022-02-10 16:00:34 +08:00
parent 31631bf4c6
commit 5702d7c7fb
2 changed files with 16 additions and 17 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "vite-plugin-ice-mars3d", "name": "vite-plugin-ice-mars3d",
"version": "1.0.9", "version": "1.0.10",
"description": "mars3d library plugin for Vite", "description": "mars3d library plugin for Vite",
"main": "dist/index.js", "main": "dist/index.js",
"types": "dist/index.d.ts", "types": "dist/index.d.ts",

View File

@ -91,24 +91,24 @@ function vitePluginCesium(
try { try {
await fs.copy( await fs.copy(
path.join(cesiumBuildPath, 'Assets'), path.join(cesiumBuildPath, 'Assets'),
path.join(outDir, 'mars3d-cesium/Assets') path.join(outDir, 'Cesium/Assets')
); );
await fs.copy( await fs.copy(
path.join(cesiumBuildPath, 'ThirdParty'), path.join(cesiumBuildPath, 'ThirdParty'),
path.join(outDir, 'mars3d-cesium/ThirdParty') path.join(outDir, 'Cesium/ThirdParty')
); );
await fs.copy( await fs.copy(
path.join(cesiumBuildPath, 'Workers'), path.join(cesiumBuildPath, 'Workers'),
path.join(outDir, 'mars3d-cesium/Workers') path.join(outDir, 'Cesium/Workers')
); );
await fs.copy( await fs.copy(
path.join(cesiumBuildPath, 'Widgets'), path.join(cesiumBuildPath, 'Widgets'),
path.join(outDir, 'mars3d-cesium/Widgets') path.join(outDir, 'Cesium/Widgets')
); );
if (!rebuildCesium) { if (!rebuildCesium) {
await fs.copy( await fs.copy(
path.join(cesiumBuildPath, 'Cesium.js'), path.join(cesiumBuildPath, 'Cesium.js'),
path.join(outDir, 'mars3d-cesium/Cesium.js') path.join(outDir, 'Cesium/Cesium.js')
); );
} }
await fs.copy( await fs.copy(
@ -122,13 +122,20 @@ function vitePluginCesium(
}, },
transformIndexHtml() { transformIndexHtml() {
const tags: HtmlTagDescriptor[] = [ const tags: HtmlTagDescriptor[] = [];
{ if (isBuild && !rebuildCesium) {
tags.push({
tag: 'script',
attrs: { src: normalizePath(path.join(base, 'Cesium/Cesium.js')) }
});
}
if (isBuild) {
tags.push( {
tag: 'link', tag: 'link',
attrs: { attrs: {
rel: 'stylesheet', rel: 'stylesheet',
href: normalizePath( href: normalizePath(
path.join(CESIUM_BASE_URL, 'Widgets/widgets.css') path.join('/Cesium/', 'Widgets/widgets.css')
) )
} }
}, },
@ -140,15 +147,7 @@ function vitePluginCesium(
path.join(MARS3D_BASE_URL, 'mars3d.css') path.join(MARS3D_BASE_URL, 'mars3d.css')
) )
} }
}
];
if (isBuild && !rebuildCesium) {
tags.push({
tag: 'script',
attrs: { src: normalizePath(path.join(base, 'mars3d-cesium/Cesium.js')) }
}); });
}
if (isBuild) {
tags.push({ tags.push({
tag: 'script', tag: 'script',
attrs: { src: normalizePath(path.join(MARS3D_BASE_URL, 'mars3d.js')) } attrs: { src: normalizePath(path.join(MARS3D_BASE_URL, 'mars3d.js')) }