vue3-popper icon indicating copy to clipboard operation
vue3-popper copied to clipboard

Content Security Policy Header Errors

Open jmartypax8 opened this issue 3 years ago • 2 comments

Description of the bug A clear and concise description of what the bug is.

  • Rollup build generates only a JS file that dynamically injects inline CSS into our app. This cause a problem with our app's Content Security Policy headers

Reproduction link If you can, create a reproduction on CodeSandbox

// In file vue3-popper/dist/popper.ssr.js
function render(_ctx, _cache) {
  return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$1);
}function styleInject(css, ref) {
  if ( ref === void 0 ) ref = {};
  var insertAt = ref.insertAt;

  if (!css || typeof document === 'undefined') { return; }

  var head = document.head || document.getElementsByTagName('head')[0];
  var style = document.createElement('style');
  style.type = 'text/css';

  if (insertAt === 'top') {
    if (head.firstChild) {
      head.insertBefore(style, head.firstChild);
    } else {
      head.appendChild(style);
    }
  } else {
    head.appendChild(style);
  }

  if (style.styleSheet) {
    style.styleSheet.cssText = css;
  } else {
    style.appendChild(document.createTextNode(css));
  }
}

To Reproduce Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior A clear and concise description of what you expected to happen.

  • Rollup build generates a CSS and JS file so the app has the ability to use the CSS without inline injecting CSS through JS.

Screenshots If applicable, add screenshots to help explain your problem. Screen Shot 2022-02-08 at 12 04 49 PM Screen Shot 2022-02-08 at 12 05 25 PM

jmartypax8 avatar Feb 08 '22 19:02 jmartypax8

Hi, I have the same bug.

Is there any workaround to this problem?

thanks

franjfgcarmo avatar Jun 27 '22 17:06 franjfgcarmo

Is there any solution to this?

AdSegura avatar Jun 17 '23 18:06 AdSegura