-
Notifications
You must be signed in to change notification settings - Fork 323
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
Plugin is not working in vue js #140
Comments
jsonfile is not for use in the browser; only in Node or Electron. |
Thanks for the reply @RyanZim , I'm using this plugin with Electron only. I got the below error, Here is my code, NOTE: Book.js and data.json files are in the same folder and I have used react js for coding. |
OK, what bundler are you using? Webpack? Does importing |
@RyanZim , package.json {
"name": "test-electron-app",
"version": "0.1.0",
"description": "Test App",
"author": "sadashiv",
"main": "public/electron.js",
"build": {
"appId": "com.test-electron-app"
},
"homepage": "./",
"dependencies": {
"@testing-library/jest-dom": "^5.11.6",
"@testing-library/react": "^11.2.2",
"@testing-library/user-event": "^12.2.2",
"@tinymce/tinymce-react": "^3.8.1",
"bootstrap": "^4.5.3",
"cross-env": "^7.0.2",
"electron-is-dev": "^1.2.0",
"jsonfile": "^6.1.0",
"node-sass": "^4.14.1",
"react": "^17.0.1",
"react-bootstrap": "^1.4.0",
"react-bootstrap-icons": "^1.1.0",
"react-dom": "^17.0.1",
"react-scripts": "4.0.1",
"smooth-scrollbar": "^8.5.3",
"web-vitals": "^0.2.4"
},
"scripts": {
"react-start": "react-scripts start",
"react-build": "react-scripts build",
"react-test": "react-scripts test",
"react-eject": "react-scripts eject",
"electron-build": "electron-builder",
"build": "npm run react-build && npm run electron-build",
"start": "concurrently \"cross-env BROWSER=none npm run react-start\" \"wait-on http://localhost:3000 && electron .\""
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"concurrently": "^5.3.0",
"electron": "^11.0.3",
"electron-builder": "^22.9.1",
"wait-on": "^5.2.0"
}
} Can I use ur plugin in development mode? Can you please tel steps to how to use ur npm package with electron and reactjs ? |
Ah, you're using react-scripts, which uses webpack under the hood. Comment out your usage of import fs from 'fs';
fs.writeFile('test.txt', 'Hello World!', (err) => {
if (err) console.error(err);
}); Run your app, see if you get an error, and if the file |
Hello,
Im trying to read/write json file, but it is not working, Im getting below error.
I Kept data.json same path where App.vue is exist.
The text was updated successfully, but these errors were encountered: