Keyhan
Keyhan

Reputation: 186

How to generate an asset-manifest.json for Vuejs exactly same as React?

I have created a fresh app using Vue CLI (PWA is enabled). I want to generate an asset-manifest.json file but with the exact same structure like what Create React App generates. For example, the asset-manifest.json file of a fresh app created by CRA, looks like this:

enter image description here

But Vue doesn't generate such a file and I had to install webpack-assets-manifest and then by adding the following configuration to vue.config.js file:

enter image description here

I was able to make the app generate this file for me. But obviously the output looks like this:

enter image description here

The question here is that how I can configure my Vue app to generate this file with the exact structure of React app (generating chunks automatically, categorizing by entrypoints and files keys, as well as generating the main.chunk.js, bundle.js files, etc.)?

I am not professional at Vue and I am used to React. So, any suggestions or thoughts from experts are welcome.

Upvotes: 1

Views: 6555

Answers (1)

Aswin K
Aswin K

Reputation: 343

I wanted to have files key, so I used the transform option like this. I also renamed app.js to main.js. This customization were enough for me, for now.

I want this to be generated during development build as well and generate bundle.js, but it doesn't generate this file till I run yarn build which I have to research on. Let me know if you have any ideas.

You can use the entrypoints: true to generate entrypoints key.

enter image description here

The generated file was like this

enter image description here

Upvotes: 2

Related Questions