Skip to content

Commit

Permalink
Ditch lazyloading polyfill in shimmie utiity, causes issues with 3rd …
Browse files Browse the repository at this point in the history
…party ESM deps.

Fixes #96 v5.0.0 failing to import Prettier plugins (`ERR_MODULE_NOT_FOUND`)
  • Loading branch information
madeleineostoja committed Jul 16, 2024
1 parent efd2a8e commit f7440e5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 27 deletions.
16 changes: 0 additions & 16 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,6 @@ import typescript from "rollup-plugin-ts";
import { preserveShebangs } from "rollup-plugin-preserve-shebangs";
import { terser } from "rollup-plugin-terser";

function retainImports() {
return {
name: "retain-import-expression",
resolveDynamicImport() {
return false;
},
renderDynamicImport() {
return {
left: "import(",
right: ")",
};
},
};
}

export default [
{
input: "src/utils/index.ts",
Expand All @@ -42,7 +27,6 @@ export default [
resolve(),
typescript({ outDir: "." }),
commonjs(),
retainImports(),
preserveShebangs(),
],
},
Expand Down
22 changes: 11 additions & 11 deletions src/utils/shimmie.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import type { CSSVarsPonyfillOptions } from "css-vars-ponyfill";
import cssVarsPonyfill, {
type CSSVarsPonyfillOptions,
} from "css-vars-ponyfill";
/**
* Conditionally load and apply a shim for CSS variables in IE
*/
Expand All @@ -11,16 +13,14 @@ export function shimmie({

if (!test) {
document.body.style.visibility = "hidden";
import("css-vars-ponyfill").then(({ default: cssVarsPonyfill }) => {
cssVarsPonyfill({
watch: true,
updateURLs: false,
onComplete() {
onComplete?.();
document.body.style.visibility = "visible";
},
...config,
});
cssVarsPonyfill({
watch: true,
updateURLs: false,
onComplete() {
onComplete?.();
document.body.style.visibility = "visible";
},
...config,
});
}
}

0 comments on commit f7440e5

Please sign in to comment.