mirror of https://github.com/nuxt/nuxt.git
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 () {
|
||||
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 () {
|
||||
|
|
Loading…
Reference in New Issue