Currently, I am utilizing Vue.js
and Gridsome
to craft a personalized portfolio. However, an issue arose when I attempted to incorporate a JSON file to store my profile details on the site. Here is how I imported the file within my Index.vue
component:
<script>
import Intro from "~/components/Intro.vue";
import profile from "~/data/profile.json";
export default {
components: {
Intro,
},
metaInfo: {
title: "Farzin Nasiri",
},
data: () => ({
profile
}),
};
</script>
and this is how it is utilized:
<Intro :personal="profile.personal" />
During development (command: gridsome develop
), everything runs smoothly and the data is retrieved correctly. However, upon building the project (command: gridsome build
) which generates build files within the dist
directory, the following error occurs:
Initializing plugins...
Load sources - 0.04s
Create GraphQL schema - 0.05s
Create pages and templates - 0.03s
Generate temporary code - 0.03s
Bootstrap finish - 0.67s
Compile assets - 13.28s
Execute GraphQL (6 queries) - 0.03s
Write out page data (6 files) - 0s
Could not generate HTML for "/":
TypeError: Cannot read property '__esModule' of undefined
at i (/home/farzin/MyProjects/portfolio.farzinnasiri.com/node_modules/vue-server-renderer/build.prod.js:1:68670)
Here is the layout of my project structure (src folder):
├── components
│ ├── Intro.vue
│ └── README.md
├── data
│ └── profile.json
├── favicon.png
├── layouts
│ ├── Default.vue
│ └── README.md
├── main.js
├── pages
│ ├── About.vue
│ ├── Index.vue
│ └── README.md
├── templates
│ ├── README.md
│ └── Work.vue
└── vendor
└── bootstrap.min.css
Below is my package.json
:
{
"name": "portfolio.farzinnasiri.com",
"version": "0.0.2",
"private": true,
"scripts": {
"build": "gridsome build",
"develop": "gridsome develop",
"explore": "gridsome explore"
},
"dependencies": {
"@fortawesome/fontawesome-svg-core": "^1.2.28",
"@fortawesome/free-brands-svg-icons": "^5.13.0",
"@fortawesome/free-solid-svg-icons": "^5.13.0",
"@fortawesome/vue-fontawesome": "^0.1.9",
"@gridsome/source-filesystem": "^0.6.2",
"@gridsome/transformer-remark": "^0.5.0",
"gridsome": "^0.7.0"
}
}
I am struggling to pinpoint the root cause of this problem and would greatly appreciate any assistance in resolving it. Thank you for your time.