Skip to content

Support both commonJS and ES modules during server side render.

Tomas Vik requested to merge es-syntax-in-frontend-code into develop

Since introducing Vue to the codebase we faced issues with the vue-server-renderer not understanding advanced ES syntax. The issue (AFAIK) was that we needed to use babel plugin @babel/plugin-transform-runtime but we couldn't because the plugin couldn't handle mixture of commonjs and ES modules.

Setting sourceType to unambiguous makes babel (I assume) look into each file and decide what module system to use.

I've added small async/await refactoring to demonstrate that the change works. The refactored code is covered by tests but I did some local testing as well.

Merge request reports