修复date-fns-tz导入失败问题
在执行yarn build打包node项目时,出现以下错误: [vite]: Rollup failed to resolve import "date-fns/_lib/cloneObject/index.js" from "node_modules/date-fns-tz/esm/formatInTimeZone/index.js". This is most likely unintended because it can break your application at runtime. If you do want to externalize this module explicitly add it to `build.rollupOptions.external` error during build: Error: [vite]: Rollup failed to resolve import "date-fns/_lib/clon…
2022-09-23vite项目在二级目录下的部署
使用history路由模式,假定项目在admin目录下,需要使用类似于如下url访问: https://myapp.com/admin/auth/login https://myapp.com/admin/dashboard 修改 公共基础路径,适配静态文件。 vite.config.js export default defineConfig({ base: '/admin/', // ... }); 修改路由前缀,内部路由跳转时追加上前缀。 src/router/index.ts const router = createRouter({ history: createWebHistory('/admin/'), routes }) Nginx 配置。 location /admin { …
2021-11-29