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

Patch Lit server shim to fix sass compatability #3511

Merged
merged 2 commits into from
Jun 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/famous-pens-cheer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@astrojs/lit': patch
---

Patch Lit's server shim to allow for `sass` compatability
3 changes: 2 additions & 1 deletion packages/integrations/lit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@
"devDependencies": {
"astro": "workspace:*",
"astro-scripts": "workspace:*",
"cheerio": "^1.0.0-rc.11"
"cheerio": "^1.0.0-rc.11",
"sass": "^1.52.1"
},
"peerDependencies": {
"@webcomponents/template-shadowroot": "^0.1.0",
Expand Down
2 changes: 2 additions & 0 deletions packages/integrations/lit/server-shim.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ installWindowOnGlobal();

window.global = window;
document.getElementsByTagName = () => [];
// See https://github.com/lit/lit/issues/2393
document.currentScript = null;
14 changes: 14 additions & 0 deletions packages/integrations/lit/test/sass.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { expect } from 'chai';

describe('check', () => {
it('should be able to load sass', async () => {
let error = null;
try {
await import(new URL('../server-shim.js', import.meta.url));
await import('sass');
} catch (e) {
error = e;
}
expect(error).to.be.null;
});
});
11 changes: 11 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.