Closed fooman closed 4 years ago
Hi @fooman. Thank you for your report. To help us process this issue please make sure that you provided sufficient information.
Please, add a comment to assign the issue: @magento I am working on this
Hi @fooman ,
I think this happens because create-pwa scaffolds from 6.0.1 hence this is not included in the package.json
.
Created PWA-730 in Jira backlog for grooming
@awilcoxa I'd probably take the severity down on this one. It's possible to manually copy this into one's own package.json and there would currently be nothing in existence that would break due to it missing. Longer term it has more an educational impact on introducing a common way to customise pwa studio via targets.
How would you use the local-intercept.js file?
@wokakira you could for example add a new route
function localIntercept(targets) {
targets.of('@magento/venia-ui').routes.tap(routes => [
...routes,
{
name: 'Blog New',
pattern: '/blog/:urlKey?',
exact: false,
path: '../../../../../../src/RootComponents/Blog'
}
]);
}
module.exports = localIntercept;
@wokakira: You can try with steps as followings: 1. In the file at path: path_to_your_custom_project/package.json you declare as the following:
"pwa-studio": { "targets": { "intercept": "./local-intercept.js" } }
2. In the file at path: path_to_your_custom_project/local-intercept.js you declare as the following:
function localIntercept(targets) { targets.of('@magento/venia-ui').routes.tap(routes => [ ...routes, { name: 'Custom Title', pattern: '/custom-route', exact: true, path: 'path_to_your_custom_project/src/components/CustomComponent' } ]); return targets; } module.exports = localIntercept;
Thanks @quynhvv @fooman
Describe the bug pwa-studio section missing from packages.json when installed via create-pwa
To reproduce Note comment in
local-intercept.js
try to locate the above in a project based on create-pwa.
Expected behavior The above should exist.
Possible solutions https://github.com/magento/pwa-studio/pull/2514
Please complete the following device information:
npm -v
:node -v
:Please let us know what packages this bug is in regards to:
venia-concept
venia-ui
pwa-buildpack
peregrine
pwa-devdocs
upward-js
upward-spec
create-pwa