vite-plugin-singlefile
vite-plugin-singlefile copied to clipboard
Problem with non-full embedding
The problem is when you have some unembedding content in public folder. Even if you have unembedding content you have to embed js to neutralize CORS. So js in fact is moving to parent folder (from assets) and all links of imported from public pictures became broken.
This situation is typical for using relative paths: base: ''
To fix this problem we should move js to the root folder using rollupOptions:
{
base: '',
plugins: [
vue(),
viteSingleFile({
useRecommendedBuildConfig: false,
inlinePattern: [
'**/*.js'
]
}),
],
build: {
rollupOptions: {
output: {
chunkFileNames: '[name]-[hash].js',
entryFileNames: '[name]-[hash].js',
},
},
}
}
We should change this rollup options automatically if we have jsAssets or just describe it in help.
Hi @dlnsk,
I'm not entirely following. Are you suggesting that we change the recommended configuration? If so, would there be any negative impacts for others who are not using the inlinePattern
option?