|
| 1 | +import { readFileSync } from 'node:fs' |
| 2 | +import { template } from 'lodash-es' |
1 | 3 | /**
|
2 | 4 | * @module nuxt-vuefire
|
3 | 5 | */
|
@@ -169,7 +171,13 @@ export default defineNuxtModule<VueFireNuxtModuleOptions>({
|
169 | 171 |
|
170 | 172 | // this adds the VueFire plugin and handle SSR state serialization and hydration
|
171 | 173 | addPluginTemplate({
|
172 |
| - src: normalize(resolve(templatesDir, 'plugin.ejs')), |
| 174 | + getContents({ options }) { |
| 175 | + const contents = readFileSync( |
| 176 | + normalize(resolve(templatesDir, 'plugin.ejs')), |
| 177 | + 'utf-8' |
| 178 | + ) |
| 179 | + return template(contents)({ options }) |
| 180 | + }, |
173 | 181 | filename: 'vuefire-plugin.mjs',
|
174 | 182 | options: {
|
175 | 183 | ssr: nuxt.options.ssr,
|
@@ -232,7 +240,13 @@ export default defineNuxtModule<VueFireNuxtModuleOptions>({
|
232 | 240 | if (options.auth.enabled) {
|
233 | 241 | // hydrates the user if any
|
234 | 242 | addPluginTemplate({
|
235 |
| - src: normalize(resolve(runtimeDir, 'auth/plugin.client.ejs')), |
| 243 | + getContents({ options }) { |
| 244 | + const contents = readFileSync( |
| 245 | + normalize(resolve(runtimeDir, 'auth/plugin.client.ejs')), |
| 246 | + 'utf-8' |
| 247 | + ) |
| 248 | + return template(contents)({ options }) |
| 249 | + }, |
236 | 250 | filename: 'vuefire-auth-plugin.client.mjs',
|
237 | 251 | options: {
|
238 | 252 | ...options.auth,
|
|
0 commit comments