mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-23 14:15:13 +00:00
fix(webpack): use non-eval sourcemap with csp and unsafe-eval
script policy (#7305)
This commit is contained in:
parent
2bd2c3853d
commit
c2c7081dc2
@ -20,7 +20,14 @@ export default class WebpackClientConfig extends WebpackBaseConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get devtool () {
|
get devtool () {
|
||||||
return this.dev ? 'cheap-module-eval-source-map' : false
|
if (!this.dev) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
const scriptPolicy = this.getCspScriptPolicy()
|
||||||
|
const noUnsafeEval = scriptPolicy && !scriptPolicy.includes('\'unsafe-eval\'')
|
||||||
|
return noUnsafeEval
|
||||||
|
? 'cheap-module-source-map'
|
||||||
|
: 'cheap-module-eval-source-map'
|
||||||
}
|
}
|
||||||
|
|
||||||
getCspScriptPolicy () {
|
getCspScriptPolicy () {
|
||||||
|
Loading…
Reference in New Issue
Block a user