Skip to content

Commit

Permalink
Merge pull request #21 from laravel/remove-ziggy-alias
Browse files Browse the repository at this point in the history
remove ziggy alias
  • Loading branch information
jessarcher authored Jun 17, 2022
2 parents 9671bd7 + 16d61a8 commit 84f3f78
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 27 deletions.
2 changes: 0 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,7 @@ export default function laravel(config: string|string[]|PluginConfig): LaravelPl
let resolvedConfig: ResolvedConfig
const cssManifest: Manifest = {}

const ziggy = 'vendor/tightenco/ziggy/dist/index.es.js';
const defaultAliases: Record<string, string> = {
...(fs.existsSync(ziggy) ? { ziggy } : undefined),
'@': '/resources/js',
};

Expand Down
25 changes: 0 additions & 25 deletions tests/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { afterEach, describe, expect, it, vi } from 'vitest'
import laravel from '../src'
import fs from 'fs'

describe('laravel-vite-plugin', () => {
afterEach(() => {
Expand Down Expand Up @@ -169,30 +168,6 @@ describe('laravel-vite-plugin', () => {
])
})

it('provides an ziggy alias when installed', () => {
vi.spyOn(fs, 'existsSync').mockReturnValueOnce(true)

const plugin = laravel('resources/js/app.js')

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

expect(config.resolve.alias['ziggy']).toBe('vendor/tightenco/ziggy/dist/index.es.js')
})

it('provides an ziggy alias when installed and using an alias array', () => {
vi.spyOn(fs, 'existsSync').mockReturnValueOnce(true)

const plugin = laravel('resources/js/app.js')

const config = plugin.config({
resolve: {
alias: [],
}
}, { command: 'build', mode: 'development' })

expect(config.resolve.alias).toContainEqual({ find: 'ziggy', replacement: 'vendor/tightenco/ziggy/dist/index.es.js' })
})

it('configures the Vite server when inside a Sail container', () => {
process.env.LARAVEL_SAIL = '1'
const plugin = laravel('resources/js/app.js')
Expand Down

0 comments on commit 84f3f78

Please sign in to comment.