diff options
author | 2022-06-02 14:45:11 -0500 | |
---|---|---|
committer | 2022-06-02 14:45:11 -0500 | |
commit | 2fedb974899b37a8d9ddabc476764a6d35d1e446 (patch) | |
tree | 610213f78c40af83a530a84d2f5ee14b134672ec /packages/integrations/lit | |
parent | a74cf98002a23aa7de0e383f49ef4170f951e99f (diff) | |
download | astro-2fedb974899b37a8d9ddabc476764a6d35d1e446.tar.gz astro-2fedb974899b37a8d9ddabc476764a6d35d1e446.tar.zst astro-2fedb974899b37a8d9ddabc476764a6d35d1e446.zip |
Patch Lit server shim to fix sass compatability (#3511)
* fix(#2623, #3508): patch lit server shim to allow sass compat
* chore: add changeset
Diffstat (limited to 'packages/integrations/lit')
-rw-r--r-- | packages/integrations/lit/package.json | 3 | ||||
-rw-r--r-- | packages/integrations/lit/server-shim.js | 2 | ||||
-rw-r--r-- | packages/integrations/lit/test/sass.test.js | 14 |
3 files changed, 18 insertions, 1 deletions
diff --git a/packages/integrations/lit/package.json b/packages/integrations/lit/package.json index 6f6bbdb70..730a1bd41 100644 --- a/packages/integrations/lit/package.json +++ b/packages/integrations/lit/package.json @@ -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", diff --git a/packages/integrations/lit/server-shim.js b/packages/integrations/lit/server-shim.js index 054679592..0c1fde383 100644 --- a/packages/integrations/lit/server-shim.js +++ b/packages/integrations/lit/server-shim.js @@ -3,3 +3,5 @@ installWindowOnGlobal(); window.global = window; document.getElementsByTagName = () => []; +// See https://github.com/lit/lit/issues/2393 +document.currentScript = null; diff --git a/packages/integrations/lit/test/sass.test.js b/packages/integrations/lit/test/sass.test.js new file mode 100644 index 000000000..9bc039db6 --- /dev/null +++ b/packages/integrations/lit/test/sass.test.js @@ -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; + }); +}); |