diff --git a/frontend/src/metabase/app.js b/frontend/src/metabase/app.js index 763025917e8800a4296f7f2e47b2a2f4e33e89d8..568b378424556a0a16ceb87d1b9b2e89c075505c 100644 --- a/frontend/src/metabase/app.js +++ b/frontend/src/metabase/app.js @@ -24,6 +24,9 @@ import "metabase/plugins/builtin"; // If EE isn't enabled, it loads an empty file. import "ee-plugins"; // eslint-disable-line import/no-duplicates +// Set nonce for mantine v6 deps +import "metabase/lib/csp"; + import { createHistory } from "history"; import { DragDropContextProvider } from "react-dnd"; import HTML5Backend from "react-dnd-html5-backend"; diff --git a/frontend/src/metabase/dev.js b/frontend/src/metabase/dev.js index 8467b323d1ddc2ebc0b5cf154acde9b688c3af6c..0b574c8e9a5b300d772d3d10340b38a784165542 100644 --- a/frontend/src/metabase/dev.js +++ b/frontend/src/metabase/dev.js @@ -1,13 +1 @@ import "cljs/metabase.util.devtools"; - -/** - * setNonce is required for react-remove-scroll which adds style and can handle - * nonce but the method we use to set nonce is not compatible with - * react-remove-scroll it expects __webpack_nonce__ to be defined, when we - * generate it at BE and put directly into html file. `get-nonce` is used inside - * react-remove-scroll to get nonce, so we put it manually here. - * react-remove-scroll is a dependency of mantine v6 - */ -import { setNonce } from "get-nonce"; - -setNonce(window.MetabaseNonce); diff --git a/frontend/src/metabase/lib/csp.js b/frontend/src/metabase/lib/csp.js new file mode 100644 index 0000000000000000000000000000000000000000..aa26382769f9d7b776a8b4d4438dfd5d2231071a --- /dev/null +++ b/frontend/src/metabase/lib/csp.js @@ -0,0 +1,13 @@ +/** + * setNonce is required for react-remove-scroll which adds style and can handle + * nonce but the method we use to set nonce is not compatible with + * react-remove-scroll it expects __webpack_nonce__ to be defined, when we + * generate it at BE and put directly into html file. `get-nonce` is used inside + * react-remove-scroll to get nonce, so we put it manually here. + * react-remove-scroll is a dependency of mantine v6 + * + * TODO: remove it when we upgrade mantine to v7 + */ +import { setNonce } from "get-nonce"; + +setNonce(window.MetabaseNonce);