Skip to content

Commit 6b56c7e

Browse files
authored
use webpack common dependency (#990)
### Description of the Changes use new `webpack-common` repo to import `insertStylesWithNonce` function. related to FEC-14367
1 parent 2d97fd5 commit 6b56c7e

File tree

3 files changed

+2758
-2907
lines changed

3 files changed

+2758
-2907
lines changed

package.json

+2
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
"release": "standard-version"
5050
},
5151
"dependencies": {
52+
"@playkit-js/webpack-common": "^1.0.1-canary.0-fc299af",
5253
"preact": "10.4.6",
5354
"preact-i18n": "2.0.0-preactx.2",
5455
"react-redux": "7.2.1",
@@ -94,6 +95,7 @@
9495
"karma-webpack": "^5.0.0",
9596
"mini-css-extract-plugin": "^2.7.6",
9697
"mocha": "^10.0.0",
98+
"playkit-js-webpack-common": "^1.0.0",
9799
"prettier": "^3.1.1",
98100
"sass": "^1.58.0",
99101
"sass-loader": "^9.0.2",

webpack.config.js

+2-6
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ const webpack = require('webpack');
22
const path = require('path');
33
const packageData = require('./package.json');
44
const CSS_MODULE_PREFIX = 'playkit';
5+
const {insertStylesWithNonce} = require('@playkit-js/webpack-common');
56

67
module.exports = (env, {mode}) => {
78
return {
@@ -42,12 +43,7 @@ module.exports = (env, {mode}) => {
4243
attributes: {
4344
id: `${packageData.name}`
4445
},
45-
insert: function insertStylesWithNonce(styleElement) {
46-
if (typeof window.kalturaGlobalConfig?.stylesNonce === 'string') {
47-
styleElement.setAttribute('nonce', window.kalturaGlobalConfig.stylesNonce);
48-
}
49-
document.head.appendChild(styleElement);
50-
}
46+
insert: insertStylesWithNonce
5147
}
5248
},
5349
{

0 commit comments

Comments
 (0)