Replies: 1 comment
-
排除后你要手动引入三方包:
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
vite.config.ts文件中使用下面的配置
build: {
cssCodeSplit: true,
rollupOptions: {
external: ['cesium'],
output: {
globals: { // 这里感觉没起作用
// cesium: path.resolve(__dirname, './public/js/Cesium/Cesium.js'),
cesium: 'Cesium',
}
}
}
}
index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite App</title>
<script type="module" src="/js/Cesium/Cesium.js"></script>
<link rel="stylesheet" href="/js/Cesium/Widgets/widgets.css">
</head>
<body>
<div id="app">
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
问题:
发布到服务器上会服下面错误
Uncaught TypeError: Failed to resolve module specifier "cesium". Relative references must start with either "/", "./", or "../".
我的配置是不是有问题,或者还有什么配置没有配的?
Beta Was this translation helpful? Give feedback.
All reactions