记一次Vue+electron实现前端调用fs模块操作系统文件
在VUE配置中开启node支持
vue.config.js
const { defineConfig } = require('@vue/cli-service')
module.exports = defineConfig({
transpileDependencies: true,
pluginOptions:{
electronBuilder:{
nodeIntegration:true
}
}
})
webpack.config.js
node: {
fs: "empty"
}