From 5cd13bc1813d7a8a67f41c7014a46cbbbbd2e3ff Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Sat, 20 Mar 2021 21:58:20 +0000 Subject: [PATCH] fix: ensure that injected plugin is inserted first closes #406 --- src/module/index.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/module/index.ts b/src/module/index.ts index a7d0c8c4..66cbcae5 100644 --- a/src/module/index.ts +++ b/src/module/index.ts @@ -72,11 +72,12 @@ const compositionApiModule: Module = function compositionApiModule() { corejsPolyfill: resolveCoreJsVersion.call(this), }) - // Global plugin to allow running onGlobalSetup + // Plugin to allow running onGlobalSetup + const globalPlugin = addResolvedTemplate.call(this, 'templates/plugin.js') - nuxtOptions.plugins.unshift( - addResolvedTemplate.call(this, 'templates/plugin.js') - ) + this.nuxt.hook('modules:done', () => { + nuxtOptions.plugins.unshift(globalPlugin) + }) // TODO: remove // Allow setting head() within onGlobalSetup