Webpack helper

The webpack helper builds the editor runtime of your theme or plugin, your editor and view scripts, the shared modules and the stylesheet. Your webpack.config.js calls it:

module.exports = require( '@saij/wp-app-framework/webpack' )( {
	slug: 'my-theme',
	root: __dirname,
} );
OptionMeaning
slugThe slug of the theme or plugin: its directory name. The script handles and the JavaScript global derive from it.
rootThe directory of the project.

Until 0.15 the helper was required by its path, ./vendor/saij/wp-app-framework/webpack.config.js; that still works.

Conventions

SourceBuilt toLoaded
src/**/Name.editor.js next to a block or block support classbuild/**/Name.editor.jsin the editor with the runtime
src/**/Name.view.js next to a block or block support classbuild/**/Name.view.jswhere the block renders
assets/**/*.editor.jsbuild/assets/**/*.editor.jsin the post and site editor
assets/**/*.view.js (document views)build/assets/**/*.view.json every page of the front end
assets/shared/**/*.js, imported as #shared/<name>build/assets/shared/**/*.jswith the scripts that import them
assets/styles.cssbuild/styles.css, build/styles.preload.phpon the front end and in the editor canvas

#shared/* needs the entry "imports": { "#shared/*": "./assets/shared/*.js" } in your package.json. The framework's own scripts go to build/vendor/wp-app-framework/. See Editor for the complete list, the script handles and the errors of the helper, and Front-end scripts and Styles.

Imports

ImportResolves to
@saij/wp-app-frameworkthe editor API of your theme or plugin (see JavaScript); not in view scripts
@saij/wp-app-framework/viewthe view API (see BlockView)
#shared/<name>a shared module of your theme or plugin
@wordpress/*the scripts of WordPress, as with @wordpress/scripts