Inject the file path of the .vue on this.$options.__source.
yarn add @d2-projects/vue-filename-injector -Dor
npm install @d2-projects/vue-filename-injector -DOnly used for vue-cli3, vue.config.js:
const VueFilenameInjector = require('@d2-projects/vue-filename-injector')
module.exports = {
chainWebpack: config => {
// ...
// in here, only with chainWebpack
VueFilenameInjector(config, {
propName: '__source' // default
})
}
}https://github.com/neutrinojs/webpack-chain https://vue-loader.vuejs.org/guide/custom-blocks.html