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'
]
}
相关平台
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
环境信息