Is it possible to get a file's output chunkId inside the file itself? #13317
-
|
I'm trying to set up an Vue 3 SSR app with webpack 5 One optimization I'm looking to make is to be able to insert [
{
name: "MainLayout"
ssrRender: [Function (anonymous)],
__props: [],
__emits: null
},
{
name: 'Home',
setup: [Function: setup],
ssrRender: [Function (anonymous)],
__props: [],
__emits: null
}
]I'm setting {
'main.js': '/public/main.02abaf13c989d45bda4a.js',
'main.css': '/public/main.720c235a3931213fae14.css',
'src_web_client_layouts_MainLayout_vue.js': '/public/src_web_client_layouts_MainLayout_vue.a6a5b21b08752df25dbb.js',
'src_web_client_layouts_MainLayout_vue.css': '/public/src_web_client_layouts_MainLayout_vue.77edb0776b5a2a7d5cd8.css',
'src_web_client_pages_Home_vue.js': '/public/src_web_client_pages_Home_vue.ba48bda92fcb74fdee65.js',
'src_web_client_pages_Home_vue.css': '/public/src_web_client_pages_Home_vue.0f2d9630ec37b61c3375.css',
}Then I just have to do simple string matching on the manifest's keys to find the correct files to insert into my output html. While this works fine, I'm wondering if it's possible to obscure my file structure (i.e. Ideally I'd like to use // MainLayout.vue
export default defineComponent({
name: PLACEHOLDER // Ideally this should be replaced by this file's output chunk id as if it was defined in DefinePlugin
}) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
You can implement own filename using |
Beta Was this translation helpful? Give feedback.
You can implement own filename using
filename: () => {}andchunkFilename: () => {}, i.e. using functions