Skip to content

Conversation

@tomokove
Copy link

Problem

The current asset autoloading implementation only supports .js and .css file extensions when reading from the Vite manifest. This causes issues when using:

  • TypeScript files (.ts, .tsx)
  • CSS preprocessors (.scss, .sass, .less)

For example, when vite.config.js has an entry like:

input: ['resources/js/app.ts']

The manifest.json contains:

"resources/js/app.ts": {
  "file": "assets/app-CbgoKSgw.js",
  "src": "resources/js/app.ts"
}

But the current code checks Str::endsWith($src, '.js') which returns false for .ts files, so these assets are not loaded.

Solution

Updated the BlastServiceProvider to support additional file extensions:

  • JavaScript/TypeScript: .js, .ts, .jsx, .tsx
  • CSS/Preprocessors: .css, .scss, .sass, .less

Testing

Tested with a Laravel project using:

  • TypeScript files in vite.config.js input
  • SCSS files in vite.config.js input
  • php artisan blast:publish successfully loads all assets

Backward Compatibility

This change is backward compatible as it only adds support for additional extensions without changing existing behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant