Skip to content

Conversation

@awithersdd
Copy link

This will only work with the changes here:

https://github.com/BasilHealth/bh-frontend/tree/feature/webpack_fixes

Specifically this requires that the server process application.component with webpack before the server starts to ensure the asset hashes work. This ensure that all templates run through webpack and have identical processing.

Both should be deployed at the same time.

This fix ensure assets are run through the asset pipeline when build is run. Without this the old check would only work in the never actually happens case of react-templates being processed when window existed.

Anduin Withers added 3 commits September 11, 2016 12:32
…rontend

in the branch that uses this to run every react template through webpack
before use.
}
props[propKey] = evaluated;
props[propKey] = `require('${ nv }')`;
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The existing implementation will only work on src with /bhf-assets/... or bhf-assets/....

My concern here is, what if we have a an img src with https://www.example.com/photo.jpg?

Do we have img src's hosted at other 1st level paths? Development-wise, we are pointing references to img's and background url-s with bhf-assets.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reviewed every existing asset with this change, the new build also preserves webpack build warnings and errors (which will show cases like this). There are currently zero such references and that seems likely to continue.

Having spent significantly more time with webpack now the original move from assets to bhf-assets was entirely unnecessary (we could have prefixed all references automatically). I went with removing explicit bhf-assets as it didn't seem necessary.

Here is an example from build_stats.json when I put an reference in intro_apps_and_trackers.rt.html:

"errors": [
    "(undefined) ./shared/components/wizard/forms/intro_apps_and_trackers.rt.html\nModule not found: Error: Cannot resolve module 'http://www.anduin.com/anduin.png' in /usr/src/app/shared/components/wizard/forms\nresolve module http://www.anduin.com/anduin.png in /usr/src/app/shared/components/wizard/forms\n  looking for modules in /usr/src/app/node_modules\n    /usr/src/app/node_modules/http: doesn't exist (module as directory)\n[/usr/src/app/node_modules/http:]\n @ ./shared/components/wizard/forms/intro_apps_and_trackers.rt.html 7:672-715",

This also results in an exception being generated for the element contents:

e.createElement("img",{src:n(!function(){var e=new Error('Cannot find module "http://www.anduin.com/anduin.png"');throw e.code="MODULE_NOT_FOUND",e}())})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants