Skip to content

works in IE dev mode, but not prod mode  #154

@glowychan

Description

@glowychan

Hello, I'm quite stumped by this and would appreciate your help. I have css-vars-polyfill imported to my create-react-app just so I can manually set the variables --bg-opacity': '1' and --text-opacity: '1' so that it would work with another library (twin.macro). It works in IE when I'm in development mode but when I deployed it the style changes were not applied. I still see the console log for onComplete in production mode, just not the style changes.

  const t0 = performance.now();

  cssVars({
    onlyLegacy    : true,
    preserveStatic: true,
    preserveVars: true,
    silent        : true,
    updateDOM     : true,
    watch         : true,

    rootElement: document,
    variables: {
      '--bg-opacity': '1',
      '--text-opacity': '1',
    },

    onComplete: (cssText, styleNodes, cssVariables, benchmark) => {
      const t1   = performance.now();
      const time = ((t1 - t0) / 1000).toFixed(2);
      console.log(`css-vars-ponyfill completed in ${time} seconds`);
      console.log(cssVariables);
    }
  });
}

export default function PolyFilledApp() {
  React.useEffect(() => {
    cssPolifill();
  }, []);

  return <App />;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions