|
1 | 1 | import { SourceMapGenerator } from 'source-map'
|
2 | 2 | import { SFCCompiler, DescriptorCompileResult } from './compiler'
|
3 | 3 | import { merge } from './source-map'
|
| 4 | +import * as path from 'path' |
4 | 5 |
|
5 | 6 | // const merge = require('merge-source-map')
|
6 | 7 |
|
@@ -221,9 +222,8 @@ export function assembleFromSource(
|
221 | 222 | ) {
|
222 | 223 | const component = (typeof script === 'function' ? script.options : script) || {}
|
223 | 224 |
|
224 |
| - if (${e(!compiler.template.isProduction)}) { |
225 |
| - component.__file = ${e(filename)} |
226 |
| - } |
| 225 | + // For security concerns, we use only base name in production mode. |
| 226 | + component.__file = ${compiler.template.isProduction ? e(path.basename(filename)) : e(filename)} |
227 | 227 |
|
228 | 228 | if (!component.render) {
|
229 | 229 | component.render = template.render
|
@@ -302,7 +302,7 @@ export function assembleFromSource(
|
302 | 302 | .replace('var staticRenderFns =', 'var __vue_staticRenderFns__ =')
|
303 | 303 | .replace('render._withStripped =', '__vue_render__._withStripped =')}
|
304 | 304 | /* style */
|
305 |
| - const __vue_inject_styles__ = ${hasStyle} ? function (inject) { |
| 305 | + const __vue_inject_styles__ = ${hasStyle ? `function (inject) { |
306 | 306 | if (!inject) return
|
307 | 307 | ${styles.map((style, index) => {
|
308 | 308 | const source = IDENTIFIER.test(style.source)
|
@@ -333,7 +333,7 @@ export function assembleFromSource(
|
333 | 333 | : '')
|
334 | 334 | )
|
335 | 335 | })}
|
336 |
| - } : undefined |
| 336 | + }` : 'undefined'} |
337 | 337 | /* scoped */
|
338 | 338 | const __vue_scope_id__ = ${hasScopedStyle ? e(scopeId) : 'undefined'}
|
339 | 339 | /* module identifier */
|
|
0 commit comments