scandipwa.build
field in your extension's package.json
cracoPlugins
field, set it to empty array.build-config
:cracoPlugins
in your package.json
with a path to your new file (relative to the extension root).module.exports
equal to an object. This object may have two keys:plugin
(required) where the plugin implementation will be definedoptions
(optional) where the plugin options will be definedplugin
key value on the step 3).package.json
:magento.js
was created in build-config
folder in our extension root.magento.js
plugin file, we define a module.exports
an object, with plugin key, where we implement extensions of Webpack and Craco configurations. We make sure:appBuild
should is set to magento/Magento_Theme
.appHtml
to public/index.php
.filename
of the HtmlWebpackPlugin
is set to ../templates/root.phtml
.file-loader
is excluding the .php
from processing, so it does not appear in the build folder along-side of others application assets.getLoader
and loaderByName
utility functions of Craco. Learn more about them in official Craco guide.@scandipwa/craco
.scandipwa.build
field in your extension's package.json
before
field, set it to empty string.build-config
:before
field in your package.json
equal to a path to your new file (relative to the extension root).module.exports
equal to a function.composer.json
in the root current theme.package.json
:composer.js
was created in build-config
folder in our extension root.process.cwd()
to determine the location of current theme. We will use process.exit()
to exit the program and stop build from running.overrideCracoConfig
- allows to customize the Craco configuration object. overrideWebpackConfig
- allows to customize the Webpack config.overrideDevServerConfig
- allows to customize the Webpack dev-server configoverrideCracoConfig
allows a plugin override the configuration object before it's process by Craco.cracoConfig
is passed into you plugin implementation by reference, which means you can modify it's values directly.appBuild
should be set to magento/Magento_Theme
and the appHtml
to public/index.php
.overrideWebpackConfig
allows plugin override the Webpack configuration object after it's been customized by Craco.webpackConfig
is passed into you plugin implementation by reference, which means you can modify it's values directly.filename
of the HtmlWebpackPlugin
. It set's it to ../templates/root.phtml
.overrideDevServerConfig
let a plugin override the dev server config object after it's been customized by Craco.