can't add assets
See original GitHub issueI’m submitting a …
[x] bug report => check the README and search github for a similar issue or PR before submitting
[x] support request => check the README and search github for a similar issue or PR before submitting
[ ] feature request
Current behavior
adding <img src="assets/pic.jpg" />
to app.component.html
(and a pic.jpg in the assets folder) gives the error: Can't resolve './assets/pic.jpg'
changing the path of the asset to relative, i.e making it <img src="../assets/pic.jpg" />
gives the error: Error: Path variable [chunkhash] not implemented in this context: assets/pic.[chunkhash].jpg
. Assets should not be relative so adding the ../
shouldn’t work in any case.
I run using: npm run build:universal-prod; npm run serve;
Expected/desired behavior
It should work. Or perhaps this is configured to work with different sort of paths? If so, please advice.
Please tell us about your environment: Windows 10
-
Browser: all
-
**Quick Solution: ** changing
chunkhash
tohash
in thewebpack.common.js
file seems to fix this error though I’m not sure what complications that might have. Although the path would need to be relative to the current location, and ideally we should just be able to doassets/pic.jpg
or something of the sort.
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (2 by maintainers)
in webpack.config.js file add like this
more https://github.com/kevlened/copy-webpack-plugin
@ahmed-anas, @artemSoliar, @theomathieubhvr done 👍