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

h5执行打包操作报错 #16314

Open
yamlling opened this issue Aug 15, 2024 · 8 comments
Open

h5执行打包操作报错 #16314

yamlling opened this issue Aug 15, 2024 · 8 comments
Labels
F-react Framework - React T-h5 Target - 编译到 H5 V-3 Version - 3.x

Comments

@yamlling
Copy link

相关平台

H5

复现仓库

https://gitee.com/yamlling_admin/taro-react-taroui.git
浏览器版本: edge127.0.2651.98
使用框架: React

复现步骤

npm run build:h5

期望结果

打包成功

实际结果

vite v4.5.3 building for production...
✓ 3 modules transformed.
✓ built in 72ms
[vite]: Rollup failed to resolve import "\app.config.ts" from "C:/Users/Notx200/Desktop/react-app/src/index.html".
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
file:///C:/Users/Notx200/Desktop/react-app/node_modules/vite/dist/node/chunks/dep-41cf5ffd.js:48216
throw new Error([vite]: Rollup failed to resolve import "${exporter}" from "${id}".\n
^

Error: [vite]: Rollup failed to resolve import "\app.config.ts" from "C:/Users/Notx200/Desktop/react-app/src/index.html".
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
at viteWarn (file:///C:/Users/Notx200/Desktop/react-app/node_modules/vite/dist/node/chunks/dep-41cf5ffd.js:48216:27)
at onwarn (C:\Users\Notx200\Desktop\react-app\node_modules@vitejs\plugin-react\dist\index.cjs:274:9)
at onRollupWarning (file:///C:/Users/Notx200/Desktop/react-app/node_modules/vite/dist/node/chunks/dep-41cf5ffd.js:48245:9)
at onwarn (file:///C:/Users/Notx200/Desktop/react-app/node_modules/vite/dist/node/chunks/dep-41cf5ffd.js:47976:13)
at file:///C:/Users/Notx200/Desktop/react-app/node_modules/rollup/dist/es/shared/node-entry.js:24276:13
at Object.logger [as onLog] (file:///C:/Users/Notx200/Desktop/react-app/node_modules/rollup/dist/es/shared/node-entry.js:25950:9)
at ModuleLoader.handleInvalidResolvedId (file:///C:/Users/Notx200/Desktop/react-app/node_modules/rollup/dist/es/shared/node-entry.js:24862:26)
at file:///C:/Users/Notx200/Desktop/react-app/node_modules/rollup/dist/es/shared/node-entry.js:24822:26 {
watchFiles: [
'taro:compiler',
'C:\Users\Notx200\Desktop\react-app\src\pages\index\index.config.ts',
'C:\Users\Notx200\Desktop\react-app\src\pages\car\index.config.ts',
'C:/Users/Notx200/Desktop/react-app/src/index.html',
'\x00vite/modulepreload-polyfill'
]
}

Node.js v18.20.4

环境信息

Taro v4.0.4


  Taro CLI 4.0.4 environment info:
    System:
      OS: Windows 11 10.0.22621
    Binaries:
      Node: 18.20.4 - C:\Program Files\nodejs\node.EXE
      Yarn: 1.22.22 - C:\Program Files\nodejs\yarn.CMD
      npm: 10.7.0 - C:\Program Files\nodejs\npm.CMD
    npmPackages:
      @tarojs/cli: 4.0.4 => 4.0.4
      @tarojs/components: 4.0.4 => 4.0.4
      @tarojs/helper: 4.0.4 => 4.0.4
      @tarojs/plugin-framework-react: 4.0.4 => 4.0.4
      @tarojs/plugin-platform-alipay: 4.0.4 => 4.0.4
      @tarojs/plugin-platform-h5: 4.0.4 => 4.0.4
      @tarojs/plugin-platform-harmony-hybrid: 4.0.4 => 4.0.4
      @tarojs/plugin-platform-jd: 4.0.4 => 4.0.4
      @tarojs/plugin-platform-qq: 4.0.4 => 4.0.4
      @tarojs/plugin-platform-swan: 4.0.4 => 4.0.4
      @tarojs/plugin-platform-tt: 4.0.4 => 4.0.4
      @tarojs/plugin-platform-weapp: 4.0.4 => 4.0.4
      @tarojs/react: 4.0.4 => 4.0.4
      @tarojs/runtime: 4.0.4 => 4.0.4
      @tarojs/shared: 4.0.4 => 4.0.4
      @tarojs/taro: 4.0.4 => 4.0.4
      @tarojs/vite-runner: 4.0.4 => 4.0.4
      babel-preset-taro: 4.0.4 => 4.0.4
      eslint-config-taro: 4.0.4 => 4.0.4
      react: ^18.0.0 => 18.3.1
      taro-ui: ^3.3.0 => 3.3.0
@taro-bot2 taro-bot2 bot added F-react Framework - React T-h5 Target - 编译到 H5 V-3 Version - 3.x labels Aug 15, 2024
@github-project-automation github-project-automation bot moved this to Padding in H5 Aug 15, 2024
@legcc
Copy link

legcc commented Aug 16, 2024

同样的问题

@yamlling
Copy link
Author

在linux下试了下 可以成功打包, 初步判断应该是windows路径的问题

@legcc
Copy link

legcc commented Aug 19, 2024

迁移到webpack正常,vite不行

@yamlling
Copy link
Author

迁移到webpack正常,vite不行

目前只能使用linux打包

@ZhuYuRan001
Copy link

迁移到webpack正常,vite不行

请问如何迁移到webpack

@Echo-pain-killer
Copy link

我也遇到这个问题,官方能不能快点解决一下啊

@Hanson8684
Copy link

坑好多,各种各样的问题

@Lier1210
Copy link

Lier1210 commented Nov 6, 2024

我试了,提示一样的报错信息,windows电脑,我重新 Taro init 一个是webpack的项目,h5打包没问题了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F-react Framework - React T-h5 Target - 编译到 H5 V-3 Version - 3.x
Projects
Status: Padding
Development

No branches or pull requests

6 participants