vite-plugin-singlefile icon indicating copy to clipboard operation
vite-plugin-singlefile copied to clipboard

Problem with non-full embedding

Open dlnsk opened this issue 2 years ago • 1 comments

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.

dlnsk avatar Aug 11 '22 05:08 dlnsk

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?

richardtallent avatar Aug 13 '22 01:08 richardtallent