Error in browser: `process` is not defined
When calling `path.resolve("tmp", ".."), this branch is triggered, causing an error in the browser (line 124 in index.js):
if (cwd === undefined)
cwd = process.cwd();
path = cwd;
Uncaught ReferenceError: process is not defined
I think this error should be caught.
+1
The problem was solved when I used join instead of resolve.
1
安装process
yarn add process -S
vite.config.ts中配置注入process
安装@rollup/plugin-inject
yarn add @rollup/plugin-inject -D
plugins里面加入
import inject from '@rollup/plugin-inject'
inject({
process: 'process/browser'
})
我的那个 is
When calling `path.resolve("tmp", ".."), this branch is triggered, causing an error in the browser (line 124 in index.js):
if (cwd === undefined) cwd = process.cwd(); path = cwd;Uncaught ReferenceError: process is not definedI think this error should be caught.
我的那个issue 已经解决了 , 可以去看看
When calling `path.resolve("tmp", ".."), this branch is triggered, causing an error in the browser (line 124 in index.js):
if (cwd === undefined) cwd = process.cwd(); path = cwd;Uncaught ReferenceError: process is not definedI think this error should be caught.
我的那个issue 已经解决了,可以去看看