Skip to content

Commit

Permalink
Patch Lit server shim to fix sass compatability (#3511)
Browse files Browse the repository at this point in the history
* fix(#2623, #3508): patch lit server shim to allow sass compat

* chore: add changeset
  • Loading branch information
natemoo-re authored Jun 2, 2022
1 parent a74cf98 commit 2fedb97
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 1 deletion.
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.

0 comments on commit 2fedb97

Please sign in to comment.