From cb83149dd7333e2791d5f035c340047729300c64 Mon Sep 17 00:00:00 2001 From: Tim MacDonald Date: Wed, 20 Jul 2022 10:56:07 +1000 Subject: [PATCH 1/2] Do not externalise inertia helpers Due to a [bugfix](https://github.com/vitejs/vite/pull/9146) in version Vite 3.0.1 we now need to revert to referencing the package by name directly in order to have Vite not externalise the helpers. Fixes: #93 --- src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index 78c646b..78c6bc7 100644 --- a/src/index.ts +++ b/src/index.ts @@ -360,7 +360,7 @@ function noExternalInertiaHelpers(config: UserConfig): true|Array /* eslint-disable-next-line @typescript-eslint/ban-ts-comment */ /* @ts-ignore */ const userNoExternal = (config.ssr as SSROptions|undefined)?.noExternal - const pluginNoExternal = ['laravel-vite-plugin/inertia-helpers'] + const pluginNoExternal = ['laravel-vite-plugin'] if (userNoExternal === true) { return true From 2d15680a04f15bfc25330bd39840e9cd44845388 Mon Sep 17 00:00:00 2001 From: Tim MacDonald Date: Wed, 20 Jul 2022 11:05:07 +1000 Subject: [PATCH 2/2] update tests --- tests/index.test.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/index.test.ts b/tests/index.test.ts index 78e8277..563349b 100644 --- a/tests/index.test.ts +++ b/tests/index.test.ts @@ -219,7 +219,7 @@ describe('laravel-vite-plugin', () => { const noSsrConfig = plugin.config({ build: { ssr: true } }, { command: 'build', mode: 'production' }) /* @ts-ignore */ - expect(noSsrConfig.ssr.noExternal).toEqual(['laravel-vite-plugin/inertia-helpers']) + expect(noSsrConfig.ssr.noExternal).toEqual(['laravel-vite-plugin']) /* @ts-ignore */ const nothingExternalConfig = plugin.config({ ssr: { noExternal: true }, build: { ssr: true } }, { command: 'build', mode: 'production' }) @@ -229,12 +229,12 @@ describe('laravel-vite-plugin', () => { /* @ts-ignore */ const arrayNoExternalConfig = plugin.config({ ssr: { noExternal: ['foo'] }, build: { ssr: true } }, { command: 'build', mode: 'production' }) /* @ts-ignore */ - expect(arrayNoExternalConfig.ssr.noExternal).toEqual(['foo', 'laravel-vite-plugin/inertia-helpers']) + expect(arrayNoExternalConfig.ssr.noExternal).toEqual(['foo', 'laravel-vite-plugin']) /* @ts-ignore */ const stringNoExternalConfig = plugin.config({ ssr: { noExternal: 'foo' }, build: { ssr: true } }, { command: 'build', mode: 'production' }) /* @ts-ignore */ - expect(stringNoExternalConfig.ssr.noExternal).toEqual(['foo', 'laravel-vite-plugin/inertia-helpers']) + expect(stringNoExternalConfig.ssr.noExternal).toEqual(['foo', 'laravel-vite-plugin']) }) it('does not configure full reload when configuration it not an object', () => {