Skip to content

Commit

Permalink
Respects users base config option (#188)
Browse files Browse the repository at this point in the history
Fixes #185
  • Loading branch information
timacdonald authored Dec 19, 2022
1 parent 846ce36 commit a1de7cf
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ function resolveLaravelPlugin(pluginConfig: Required<PluginConfig>): LaravelPlug
ensureCommandShouldRunInEnvironment(command, env)

return {
base: userConfig.base ?? command === 'build' ? resolveBase(pluginConfig, assetUrl) : '',
base: userConfig.base ?? (command === 'build' ? resolveBase(pluginConfig, assetUrl) : ''),
publicDir: userConfig.publicDir ?? false,
build: {
manifest: userConfig.build?.manifest ?? !ssr,
Expand Down
12 changes: 12 additions & 0 deletions tests/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,18 @@ describe('laravel-vite-plugin', () => {
expect(ssrConfig.build.rollupOptions.input).toBe('resources/js/ssr.ts')
})

it('respects users base config option', () => {
const plugin = laravel({
input: 'resources/js/app.ts',
})[0]

const userConfig = { base: '/foo/' }

const config = plugin.config(userConfig, { command: 'build', mode: 'production' })

expect(config.base).toBe('/foo/')
})

it('accepts a partial configuration', () => {
const plugin = laravel({
input: 'resources/js/app.js',
Expand Down

0 comments on commit a1de7cf

Please sign in to comment.