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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

StyleConfiguration.shadowDom shared styles not working with Parcel projects #1704

Open
pesaarel opened this issue Mar 8, 2023 · 4 comments
Assignees

Comments

@pesaarel
Copy link

pesaarel commented Mar 8, 2023

馃悰 Bug Report

HTML elements not styled with shadowDOM shared styles when project uses parcel.

馃 Expected Behavior

HTML elements in every view are styled with shared styles even when project uses shadowDOM and Parcel.

馃槸 Current Behavior

  1. Created aurelia project with 'npx makes aurelia' with parcel, typescript and shadowDOM.
  2. Installed bootstrap with npm i bootstrap
  3. Added link to bootstrap 5.2.x css at index.html
  4. imported css at main.ts and added bootstrap to sharedStyles of StyleConfiguration.shadowDOM().
  5. Added some elements with bootstrap style classes to index.html and my-app.html

-> Elements at index.html are styled of course, but elements at my-app.html aren't.
No errors in developer console

However shared styles seem to work when project is created with otherwise same configuration but select Webpack instead of Parcel.

馃拋 Possible Solution

馃敠 Context

I wan't to use Parcel and I'm unable to style elements with shared styles.
Workaround is to import all needed css files to views (or use Webpack instead of Parcel).

馃捇 Code Sample

Repo with Parcel:
https://github.com/pesaarel/dummy-aurelia2-app-parcel.git
Result:
2023-03-13 17 13 34 localhost 60e56765ee32

Repo with Webpack:
https://github.com/pesaarel/dummy-aurelia2-app-webpack.git
Result:
2023-03-13 17 16 08 localhost 68ba248667d1

馃實 Your Environment

Software Version(s)
Aurelia v2.0-beta
Language
Browser Vivaldi
Bundler Parcel
Operating System Windows
NPM/Node/Yarn
@brandonseydel
Copy link
Member

@pesaarel Thanks for the report. I will look into this.

@brandonseydel brandonseydel self-assigned this Mar 22, 2023
@Lichtjaeger
Copy link

I have the same problem.
Has anyone found a solution yet?

@Lichtjaeger
Copy link

It looks like it breaks with parcel V2.8.0. Where import shared from './styles/main.css' doesn't return the CSS string anymore but an empty object.

I've downgraded to parcel V2.7.0. That solved the problem for now.

@pesaarel
Copy link
Author

Okay, good to know! I'll try that when I have time.

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

3 participants