Skip to content
This repository has been archived by the owner on Oct 4, 2023. It is now read-only.

使用electron-vue 进行web打包 #857

Open
dingzesen opened this issue Apr 21, 2019 · 2 comments
Open

使用electron-vue 进行web打包 #857

dingzesen opened this issue Apr 21, 2019 · 2 comments

Comments

@dingzesen
Copy link

dingzesen commented Apr 21, 2019

使用electron-vue运行npm run build:web,进行打包时,总是出现这个问题

ERROR in ./node_modules/conf/index.js
Module not found: Error: Can't resolve 'fs' in '/Users/dingzesen/Desktop/elephant_sh/node_modules/conf'
 @ ./node_modules/conf/index.js 3:11-24
 @ ./node_modules/electron-store/index.js
 @ ./node_modules/vuex-electron/dist/persisted-state.js
 @ ./node_modules/vuex-electron/dist/index.js
 @ ./src/renderer/store/index.js
 @ ./src/renderer/main.js

ERROR in ./node_modules/electron/index.js
Module not found: Error: Can't resolve 'fs' in '/Users/dingzesen/Desktop/elephant_sh/node_modules/electron'
 @ ./node_modules/electron/index.js 1:9-22
 @ ./node_modules/vuex-electron/dist/shared-mutations.js
 @ ./node_modules/vuex-electron/dist/index.js
 @ ./src/renderer/store/index.js
 @ ./src/renderer/main.js

ERROR in ./node_modules/graceful-fs/graceful-fs.js
Module not found: Error: Can't resolve 'fs' in '/Users/dingzesen/Desktop/elephant_sh/node_modules/graceful-fs'
 @ ./node_modules/graceful-fs/graceful-fs.js 1:9-22
 @ ./node_modules/write-file-atomic/index.js
 @ ./node_modules/conf/index.js
 @ ./node_modules/electron-store/index.js
 @ ./node_modules/vuex-electron/dist/persisted-state.js
 @ ./node_modules/vuex-electron/dist/index.js
 @ ./src/renderer/store/index.js
 @ ./src/renderer/main.js

ERROR in ./node_modules/make-dir/index.js
Module not found: Error: Can't resolve 'fs' in '/Users/dingzesen/Desktop/elephant_sh/node_modules/make-dir'
 @ ./node_modules/make-dir/index.js 2:11-24
 @ ./node_modules/conf/index.js
 @ ./node_modules/electron-store/index.js
 @ ./node_modules/vuex-electron/dist/persisted-state.js
 @ ./node_modules/vuex-electron/dist/index.js
 @ ./src/renderer/store/index.js
 @ ./src/renderer/main.js

ERROR in ./node_modules/path-exists/index.js
Module not found: Error: Can't resolve 'fs' in '/Users/dingzesen/Desktop/elephant_sh/node_modules/path-exists'
 @ ./node_modules/path-exists/index.js 2:11-24
 @ ./node_modules/locate-path/index.js
 @ ./node_modules/find-up/index.js
 @ ./node_modules/pkg-up/index.js
 @ ./node_modules/conf/index.js
 @ ./node_modules/electron-store/index.js
 @ ./node_modules/vuex-electron/dist/persisted-state.js
 @ ./node_modules/vuex-electron/dist/index.js
 @ ./src/renderer/store/index.js
 @ ./src/renderer/main.js
一直报错,应该是fs用不了,所以我就在webpack.web.config.js中添加了node:{fs:'empty'},之后不报错了,但是打包后打开网页出现这个问题:Uncaught TypeError: n.existsSync is not a function,这个问题应该是获取fs为空,所以找不到,那这个fs的问题怎么解决呢?
我是直接用官网的例子,然后运行npm install 后直接打包的,还是报错
有大佬能帮忙吗?
@dingzesen
Copy link
Author

问题解决了 详细看#751

@hanshou101
Copy link

谢谢了昂,按照#751的方法,在build:web环境下排除【electron-vuex】之后,$ yarn run build:web 能够正常打包,且 index.html 文件能 正常运行不报错 了。

Thank you, follow the #751 method, after the exclusion of [electron-vuex] in the build: web environment, $ yarn run build: web can be packaged normally, and the index.html file can run normally without error.

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

No branches or pull requests

2 participants