Skip to content

Conversation

brianjhanson
Copy link
Contributor

@brianjhanson brianjhanson commented Oct 8, 2025

Moves all of our existing asset bundle assets into a packages/craftcms-asset-bundles folder and @craftcms/asset-bundles subpackage. Much like #17924 this will allow us to split the build process between legacy and modern assets.

The number of changes makes GitHub's diff choke, so important things are:

  • Register a new @assetBundles alias in the yii2-adapter that points to packages/craftcms-asset-bundles
  • Replace all $sourcePaths with @assetBundles alias paths
  • Move src and dist directories into packages/craftcms-asset-bundles

The build command is now build:bundles so you can build all the asset bundles with npm run build:bundles. Passing arguments gets a little more awkward unfortunately. To build a specific bundle you have to double up your -- so the command ends up being

npm run build:bundles -- -- --config-name=cp

This update unfortunately breaks the npm run serve ... commands because that currently relies on the front-end assets being colocated with the asset bundle class in order to resolve the dev server via the /which-asset route. I haven't figured out the best way around that, but it might just be to ignore it. Ideally we won't be doing substantial dev on any of these asset bundles going forward.

@brandonkelly
Copy link
Member

@brianjhanson looks like this broke some asset bundle tests

@brianjhanson
Copy link
Contributor Author

Found some issues with this. Closing so I can fix those up (and maybe reevaluate this approach)

@brianjhanson brianjhanson reopened this Oct 16, 2025
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.

2 participants