opentiny / opentiny/tiny-engine

🐛 [Bug]: Tiny Engine CLI形式process is not undefined

Open
#1,521 0 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

Environment

MacPro Chrome

Version

V18.20.4

Version

TinyEngine2.5.1

Link to minimal reproduction

Step to reproduce

引入了vantUI
{
{
"name": "vant-ui组件库",
"package": "vant",
"version": "4.19.8",
"script": "https://registry.npmmirror.com/vant/4.9.18/files/es/index.mjs",
"css": "https://registry.npmmirror.com/vant/4.9.18/files/lib/index.css"
},
{
"name": "vant-ui组件库",
"package": "@vant/use",
"version": "1.6.0",
"script": "https://registry.npmmirror.com/@vant/use/1.6.0/files/dist/index.esm.mjs"
},
{
"name": "@vue/shared",
"package": "@vue/shared",
"version": "3.5.14",
"script": "https://registry.npmmirror.com/@vue/shared/3.5.14/files/dist/shared.esm-bundler.js"
},
{
"name": "@vant/popperjs",
"package": "@vant/popperjs",
"version": "1.3.0",
"script": "https://registry.npmmirror.com/@vant/popperjs/1.3.0/files/dist/index.esm.mjs"
}
}

Image

在 在 vite.config.js 中增加 process 变量的注入:

const customConfig = {
envDir: './env',
publicDir: path.resolve(__dirname, './public'),
server: {
port: 8090
},
👇 在这里增加
define: {
process: {
env: {
NODE_ENV: process.env.NODE_ENV
}
}
}
}

直接fork的TinyEngine中 Design-demo可正常,但使用TinyEngineCli形式创建的项目中修改后无效,只能对源码进行pnpm patch 修改
预期项目新增下面代码,进行修复,后续版本可取消patch

Image
What is expected

No response

What is actually happening

No response

What is your project name

TinyEngine2.5.1

Any additional comments (optional)

No response

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

Start with the mentioned vite.config.js and compare the configuration in a directly forked TinyEngine Design-demo with a project created through TinyEngine CLI. Reproduce the Vant setup and trace where the CLI-generated project handles the process environment; done means the configuration works without a pnpm patch.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
build-system, frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.