opentiny / opentiny/tiny-engine

✨Q&A:常见问题答疑-第二弹

Open
#366 21 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Vue
Stars
2.8k
Forks
476
Avg merge
17h 35m
Merged PRs (30d)
1

Description

问题一: 本地执行pnpm dev启动,页面一直loading,进不去

答:
使用开发者工具看一下控制台是否产生报错,若报错如下:
GET https://npm.onmicrosoft.cn/@opentiny/vue-theme-3.11/index.css net::ERR ABORTED 403 (URLGolbalBlocked)

Access to script at "https://npm.onmicrosoft.cn/vue@3/dist/vue.runtime.esm-browser.js' from origin "http://127.0.0.1:888/ 127.0.0.1/:1g’ has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

GET https://npm.onmicrosoft.cn/vue@3/dist/vue.runtime.esm-browser.js net: :ERR_FAILED

解决方案

当前使用的cdn地址为:"npm.onmicrosoft.cn",这个地址用户的电脑可能访问不了,导致无法拿到我们依赖的组件库等内容,可尝试将npm.onmicrosoft.cn替换为unpkg.com,替换文件和位置如下:

packages/design-core/.env.development

image

packages/design-core/.env.prod

image

packages/blockToWebComponentTemplate/vite.config.js

image

在tiny-engine项目中,找到以上文件,把对应的字符串npm.onmicrosoft.cn替换为unpkg.com,替换后保存重新启动项目

问题二:本地启动没有问题,打包好之后部署到环境上,报错如下(或类似):
1711961744377

解决方案

当前使用的cdn地址为:"npm.onmicrosoft.cn",这个地址用户的电脑可能访问不了,导致无法拿到我们依赖的组件库等内容,可尝试将npm.onmicrosoft.cn替换为unpkg.com,替换文件和位置如下:

packages/design-core/.env.development

image

packages/design-core/.env.prod

image

packages/blockToWebComponentTemplate/vite.config.js

image

在tiny-engine项目中,找到以上文件,把对应的字符串npm.onmicrosoft.cn替换为unpkg.com,替换后保存重新打包部署。

问题三:本地执行打包命令后,生成的产物在哪个文件夹?

答: tiny-engine/packages/design-core/dist/

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Review the Q&A against packages/design-core/.env.development, packages/design-core/.env.prod, packages/blockToWebComponentTemplate/vite.config.js, and the packages/design-core/dist output location. Confirm that the documented CDN troubleshooting steps and build-output path still match the project, then update the Q&A if they do not.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
documentation, frontend
Issue type
Documentation
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.