Creating a build pipeline

Note

The dev bundle is used to generate this configuration. See the Dev Bundle docs for more information.

Run the following command to create a new asset pipeline:

./bin/console perform-dev:assets:init

Your project directory will now contain the following files:

/my-app/
├── node_modules/     # installed with npm or yarn
├── src/              # application asset sources
├── vendor/           # perform asset sources
├── web/              # destination of built asset files
├── asset-paths.js    # auto-generated file containing all namespaces and entrypoints for the build tool
├── .babelrc          # javascript compilation configuration
├── package.json      # required dependencies across all bundles
├── webpack.config.js # build tool configuration (webpack)
└── yarn.lock         # optional lock file for tracking exact node_modules/ versions

In summary: webpack builds asset sources from src/, vendor/, and node_modules/, using asset-paths.js to resolve paths and entrypoints, and places them in web/.

You should commit most of these files to version control, excluding vendor/ (composer packages), node_modules/ (npm packages), and asset-paths.js (generated by Perform automatically).

To build the assets, clear the cache and run webpack:

./bin/console cache:clear # generates asset-paths.js
npm install               # or use yarn
npm run build             # runs webpack, task defined in package.json

Using different build tools