Vux environment is built with Nuxt.js.
When I put a value in the input field and press the button, I want to write it as json data and write it to a file.
The error "fs.writeFileSync is not a function" appears and the file cannot be exported.

# pages/index.vue
    <form action = "/ thanks" method = "post">
         (1) Enter your name. 
        <input v-model = "yourName" type = "text">
         (2) Enter the message. 
        <textarea v-model = "yourMessage" />
      <input type = "submit" value = "send" @ click = "exportMessage">
export default {
  data () {
    return {
      yourName: '',
      yourMessage: ''
  methods: {
    exportMessage () {
      const fs = require ('fs')
      const data = {
        yourName: this.yourName,
        yourMessage: this.yourMessage
      fs.writeFileSync ('test.json', JSON.stringify (data))

The code is currently in the above state.
When you use "fs.writeFileSync", you shouldn't write inmethod, but I don't know how to do it.