Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.0.0-beta.16 broke the "assets" functionality #2396

Closed
vkniazeu opened this issue Sep 28, 2016 · 12 comments · Fixed by #2537
Closed

1.0.0-beta.16 broke the "assets" functionality #2396

vkniazeu opened this issue Sep 28, 2016 · 12 comments · Fixed by #2537
Labels
P1 Impacts a large percentage of users; if a workaround exists it is partial or overly painful

Comments

@vkniazeu
Copy link

vkniazeu commented Sep 28, 2016

  1. Windows 10 Pro 64-bit.
  2. angular-cli: 1.0.0-beta.16
    node: 6.7.0
    os: win32 x64
  3. Updated from 1.0.0-beta.15 to 1.0.0-beta.16.
    Same exact "assets" directory and related config files setup worked fine before.
  4. ERROR in ./src/app/login/login.component.html
    Module not found: Error: Can't resolve './assets/logo.png' in 'C:\project1\src\app\login'
    @ ./src/app/login/login.component.html 1:92-120
    @ ./src/app/login/login.component.ts
    @ ./src/app/login/index.ts
    @ ./src/app/app.module.ts
    @ ./src/app/index.ts
    @ ./src/main.ts
    @ multi main
  5. Are there any new restrictions on what assets can be used and how they need to be configured?
    The CHANGELOG doesn't seem to indicate anything that would be related to the assets.
    Could fix(build): use config output path as default #2158 have potentially affected this flow?
@thephred
Copy link

thephred commented Sep 28, 2016

I made the comment in the gitter room. Please disregard, it was a red herring.

@ellipizle
Copy link

same problem here too

@monojack
Copy link
Contributor

Was able to fix that by adding a / în front of assets. So, assets/logo.png should be /assets/logo.png.

@ellipizle
Copy link

yes. that solve the issue

@jfmaeck
Copy link

jfmaeck commented Sep 29, 2016

OK, that sounds like a workaround for most cases, thank you @monojack .

Has anybody any idea how to overcome this issue if my app is not not served directly from the root of my domain (but from a subdirectory)?

By the way, this problem creeped into beta.15, too. Our project was building just fine but on a fresh checkout and npm install, since today it is broken ...

@Bulan
Copy link

Bulan commented Sep 29, 2016

Same here, working on beta 15, now either have to use / in path or make the relative path point up to src by using appropriate number of ../.
I.e in my src/app/shared/layout/header/header.html, I have to use../../../../assets/someimg.jpg

@clydin
Copy link
Member

clydin commented Sep 29, 2016

It looks like the use of the html-loader was added via the AOT support PR. (commit: d296778)
html-loader attempts to find the assets at build time and assumes the assets are relative to the referencing HTML file.

@hansl

@davinkevin
Copy link
Contributor

davinkevin commented Oct 1, 2016

The solution of @monojack doesn't work if you publish with a different <base></base> (with ng github-pages:deploy for example). This lead to broken assets

@MuhammedHasan
Copy link

MuhammedHasan commented Oct 5, 2016

As @davinkevin mention, it do not work with custom base tag.

@vkniazeu vkniazeu changed the title 1.0.0-beta.16 update broke the assets functionality 1.0.0-beta.16 broke the assets functionality Oct 5, 2016
@vkniazeu vkniazeu changed the title 1.0.0-beta.16 broke the assets functionality 1.0.0-beta.16 broke the "assets" functionality Oct 5, 2016
@filipesilva filipesilva added command: build P1 Impacts a large percentage of users; if a workaround exists it is partial or overly painful labels Oct 5, 2016
@filipesilva
Copy link
Contributor

filipesilva commented Oct 5, 2016

@TheLarkInn is there a way to use https://github.com/webpack/html-loader in which it works with relative paths AND with changed base-href?

Edit: some context webpack-contrib/html-loader#85

@filipesilva
Copy link
Contributor

We've reverted the change that lead to this scenario in #2537.

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
P1 Impacts a large percentage of users; if a workaround exists it is partial or overly painful
Projects
None yet
Development

Successfully merging a pull request may close this issue.