Replies: 2 comments 11 replies
-
Also I just saw something interesting. When there is no aemViteImportRewriter plugin being used the output in my bundle.js files is:
When I enable the plugin the output is:
As you can see the array is now empty behind |
Beta Was this translation helpful? Give feedback.
-
Hi @Jdruwe, Apologies for the delay in replying. I will answer your first post first. When I initially built AEM Vite I noticed that CSS behaved differently when customising the rollup options but didn't experience the same issue when using VIte standalone. For the projects that I work on daily I also noticed that CSS doesn't get extracted from the JS outputs when it should be and I still haven't found an explanation for this behaviour. For now, keeping CSS as a separate entry works fine for my needs but I'm happy to go back and review this in the hope that things work better after some Vite/rollup releases. As for your second question, I will raise an issue for this in the https://github.com/aem-vite/import-rewriter repo as I imagine the rewrite is changing Vite's transform behaviour which is not something I'd expect it to do. |
Beta Was this translation helpful? Give feedback.
-
I found your repo and was really interested into your implementation as we are also working with AEM and looking into Vite. One thing I am wondering is how you would handle a css import within dynamically imported javascript files.
I've created a test setup on my local machine where the manifest looks like this:
The include of the actual files:
When I click a button the
chunks/other-module.73a4d6e6.js
is dynamically imported but it seems like the css (css/other-module.css
) is not included.At https://www.aemvite.dev/guide/front-end/vite/#source-structure I've read the following:
Do you recommend that approach because of the issue that I described above so that all css is included within a single file and no css will ever be included from within javascript files?
Beta Was this translation helpful? Give feedback.
All reactions