Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Component] [tour] CDN 下使用el-tour 会报错aria.ts:22 Uncaught (in promise) ReferenceError: process is not defined #16861

Closed
360060316 opened this issue May 14, 2024 · 11 comments · Fixed by #16870

Comments

@360060316
Copy link

Bug Type: Component

Environment

  • Vue Version: 3.4.27
  • Element Plus Version: 2.7.3
  • Browser / OS: Mozilla/5.0 (iPhone; CPU iPhone OS 16_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.6 Mobile/15E148 Safari/604.1 Edg/124.0.0.0
  • Build Tool: Vite

Reproduction

Related Component

  • el-tour

Reproduction Link

Docs

Steps to reproduce

调试 发布均不能正常

What is Expected?

正常运行

What is actually happening?

控制台报错

Additional comments

(empty)

@warmthsea
Copy link
Contributor

Please provide a mini reproduction and screenshot.

@plainheart
Copy link
Member

plainheart commented May 15, 2024

检查了构建后的代码,确实包含了 process.env 相关用法。

https://unpkg.com/element-plus@2.7.3/dist/index.full.js

似乎是当前构建脚本中 esbuild define 定义的 process.env.NODE_ENV 并未将 Tour 组件内引用的三方库 floating-ui 代码内的 process.env.NODE_ENV 替换,不太清楚什么原因 🤔。不过如果最后再用 rollup 的 replace plugin 替换一次的话,似乎就没问题。

// ...
+import replace from '@rollup/plugin-replace'

esbuild({
  // ...
  define: {
    'process.env.NODE_ENV': JSON.stringify('production'),
  },
  // ...
}),
+replace({
+  'process.env.NODE_ENV': JSON.stringify('production'),
+}),

cc: @btea @warmthsea

@warmthsea
Copy link
Contributor

@360060316
Copy link
Author

plugins: [ replace({ 'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV), }) ]

并不能解决问题

@warmthsea
Copy link
Contributor

plugins: [ replace({ 'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV), }) ]

并不能解决问题

需要elp库更改

@plainheart
Copy link
Member

@warmthsea 要不你开个 PR 先按这个方案改下?

@warmthsea
Copy link
Contributor

@warmthsea 要不你开个 PR 先按这个方案改下?

好的

@warmthsea
Copy link
Contributor

@360060316
稍后我会发个私包,临时解决你的问题

@360060316
Copy link
Author

测试dev版已修复

@warmthsea
Copy link
Contributor

warmthsea commented May 15, 2024

测试dev版已修复

请于正式版2.7.4发布后替换为正式版的地址

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants