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

Esmodule hoisting

Open suguanYang opened this issue 2 years ago • 3 comments

Hi Crcong, I was using your excellent plugin in my own project, thanks for the work!

Since the esbuild used by vite is relying on the hoisted feature of esmodule, see https://github.com/evanw/esbuild/issues/1395#issuecomment-869026051, there would a chance the error: cannot access xxx before initialization will be occurred if we just replace the import statments with const declaration inline. Any thoughts on this?

suguanYang avatar Sep 11 '22 07:09 suguanYang

I can give an example if needed

suguanYang avatar Sep 11 '22 08:09 suguanYang

any updates on this ?

Joshuajrodrigues avatar Jan 09 '24 18:01 Joshuajrodrigues

any updates on this ?

I just append the new statement to the start of the file https://github.com/suguanYang/next-web/blob/834df2c753025536af2ff4f49df7faffa05536ad/packages/server/src/config/plugins/vite-plugin-externals/index.ts#L63

suguanYang avatar Jan 10 '24 02:01 suguanYang