mirror of
https://gitee.com/vuejs/vue.git
synced 2024-12-04 21:17:55 +08:00
add csp warning
This commit is contained in:
parent
8e35604dab
commit
0b1460d4d5
@ -1,11 +1,30 @@
|
||||
/* @flow */
|
||||
|
||||
import { extend } from 'shared/util'
|
||||
import { warn } from 'core/util/debug'
|
||||
import { compile as baseCompile } from 'compiler/index'
|
||||
import modules from 'web/compiler/modules/index'
|
||||
import directives from 'web/compiler/directives/index'
|
||||
import { isReservedTag, isUnaryTag, mustUseProp, getTagNamespace } from 'web/util/index'
|
||||
|
||||
// detect possible CSP restriction
|
||||
/* istanbul ignore if */
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
try {
|
||||
new Function('return 1')
|
||||
} catch (e) {
|
||||
if (e.toString().match(/unsafe-eval|CSP/)) {
|
||||
warn(
|
||||
'It seems you are using the standalone build of Vue.js in an ' +
|
||||
'environment with Content Security Policy that prohibits unsafe-eval. ' +
|
||||
'The template compiler cannot work in this environment. Consider ' +
|
||||
'relaxing the policy to allow unsafe-eval or pre-compiling your ' +
|
||||
'templates into render functions.'
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
type CompiledFunctions = {
|
||||
render: Function,
|
||||
staticRenderFns: Array<Function>
|
||||
|
Loading…
Reference in New Issue
Block a user