pwa-studio-fallback
v1.0.1
Published
https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby/src/internal-plugins/webpack-theme-component-shadowing/index.js
Downloads
1
Readme
Shameless copy pasta of Gatsby Component Shadowing for use with Magento PWA Studio
https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby/src/internal-plugins/webpack-theme-component-shadowing/index.js
Thank those brilliant minds for putting that together!
Magento PWA Setup, and Fallback Installation
yarn create @magento/pwa
yarn add -D pwa-studio-fallback
This module leverages the PWA Build Bus from pwa-studio to automatically adjust the webpack config to include this fallback resolver plugin.
Usage
Usage here matches usage from Gatsby Component Shadowing.
Example
Complete Override
To override the Header component from @magento/venia-ui
, you must:
- Identify the path of the file in
@magento/venia-ui
:@magento/venia-ui/lib/components/Header/header.js
- Remove
lib
from the path:@magento/venia-ui/components/Header/header.js
- Use the resulting path in the new theme:
src/@magento/venia-ui/components/Header/header.js
- Run
yarn watch
Now the header.js
in src
will be used instead of the header in @magento/venia-ui
Getting original component for modification
If we wanted to simply wrap a component from @magento/venia-ui
with a div
:
- Follow steps from before
- in
src/@magento/venia-ui/components/Header/header.js
import the original file path:import Header from '@magento/venia-ui/lib/components/Header/header
- export a new component:
export default (props) => (<div><Header {...props} /></div>)