Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: add Vite compatibility when lazy loading #1084

Merged
merged 14 commits into from
Mar 4, 2021
Prev Previous commit
use Set
  • Loading branch information
rchl committed Mar 3, 2021
commit e68bb6e7579d2606ebb21b60d10be76c901630e2
7 changes: 3 additions & 4 deletions src/templates/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,8 @@ for (const [key, value] of Object.entries(options)) {

<% if (options.langDir) { %>
export const ASYNC_LOCALES = {
<%= options.locales
.map(l => `'${l.file}': () => import('../${relativeToBuild(options.langDir, l.file)}' /* webpackChunkName: "lang-${l.file}" */)`)
.filter((l, index, self) => self.indexOf(l) === index)
.join(',\n ') %>
<%= Array.from(
new Set(options.locales.map(l => `'${l.file}': () => import('../${relativeToBuild(options.langDir, l.file)}' /* webpackChunkName: "lang-${l.file}" */)`))
rchl marked this conversation as resolved.
Show resolved Hide resolved
).join(',\n ') %>
}
<% } %>