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

Scoped CSS Not Being Applied To HTML Elements #2008

Open
jwbats opened this issue Oct 13, 2022 · 2 comments
Open

Scoped CSS Not Being Applied To HTML Elements #2008

jwbats opened this issue Oct 13, 2022 · 2 comments

Comments

@jwbats
Copy link

jwbats commented Oct 13, 2022

Version

17.0.0

Reproduction link

github.com

Steps to reproduce

Run project, inspect HTML to see that red and green CSS borders aren't applied to divs from the vue template.

What is expected?

Scoped styling correctly applied.

What is actually happening?

Injected CSS is scoped, but the HTML elements aren't. Therefore, the scoped CSS isn't applied to the HTML elements.


I'm not sure if this is a vue-loader bug, or a bug somewhere else, or a webpack misconfigure on my part. More details on this SO thread.

@jwbats
Copy link
Author

jwbats commented Oct 14, 2022

This was caused by a missing external in webpack.config.js.

externals: {
	vue: 'Vue'
}

@jwbats jwbats closed this as completed Oct 14, 2022
@jwbats
Copy link
Author

jwbats commented Oct 17, 2022

@alexander-akait From the css-loader repo, where I also posted this issue, feels that it should work, even without the external Vue declaration.

Maybe this is a bug after all.

Why do I need an external Vue declaration for CSS scoping to work. And why does it almost-completely work without the external declaration? Why no warnings or errors?

Can someone from vue-loader comment on this?

@jwbats jwbats reopened this Oct 17, 2022
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

No branches or pull requests

1 participant