mirror of
https://github.com/zhigang1992/connect.git
synced 2026-04-28 17:35:40 +08:00
fix: removes need for unsafe-eval CSR
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
"256": "assets/logo-128@2x.png",
|
||||
"512": "assets/logo-128@3x.png"
|
||||
},
|
||||
"content_security_policy": "script-src 'self' 'unsafe-eval'; object-src 'self'",
|
||||
"content_security_policy": "script-src 'self'<% DEV_CSR %>; object-src 'self'",
|
||||
"permissions": [
|
||||
"activeTab"
|
||||
],
|
||||
|
||||
@@ -209,6 +209,16 @@ module.exports = {
|
||||
from: path.join(sourceRootPath, 'manifest.json'),
|
||||
to: path.join(distRootPath, 'manifest.json'),
|
||||
toType: 'file',
|
||||
transform(content, path) {
|
||||
const tag = '<% DEV_CSR %>';
|
||||
content = content.toString();
|
||||
if (nodeEnv === 'development') {
|
||||
content = content.replace(tag, " 'unsafe-eval'");
|
||||
} else {
|
||||
content = content.replace(tag, '');
|
||||
}
|
||||
return Buffer.from(content);
|
||||
},
|
||||
},
|
||||
]),
|
||||
new webpack.DefinePlugin({
|
||||
|
||||
Reference in New Issue
Block a user