Tarik Hamilton

Create an asset-manifest.json (like create-react-app) using vue-cli

I needed this feature when building a WordPress plugin with vue-cli. I couldn’t enqueue the build assets since their filenames had hashes that were always changing. I wasn’t aware that this was just a webpack plugin.

I’m not sure why the vue-cli team decided to omit this, as Vue or vue-cli isn’t only used for SPAs, but it’s a surprisingly easy addition to your vue.config.js.

const WebpackAssetsManifest = require('webpack-assets-manifest') module.exports = { // ...your other modifications, configureWebpack: config => { config.plugins = config.plugins.concat( new WebpackAssetsManifest({ output: 'asset-manifest.json' }) ) } }
Code language: JavaScript (javascript)

You can change the output file name to whatever, but I recommend sticking to asset-manifest.json, as manifest.json is commonly used for PWAs.