mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-27 08:02:01 +00:00
fix(webpack): prevent terser mangling html/vue reserved tags (#4821)
This commit is contained in:
parent
6a5d0725d2
commit
6a68f4e981
@ -17,6 +17,8 @@ import PerfLoader from '../utils/perf-loader'
|
||||
import StyleLoader from '../utils/style-loader'
|
||||
import WarnFixPlugin from '../plugins/warnfix'
|
||||
|
||||
import { reservedVueTags } from '../utils/reserved-tags'
|
||||
|
||||
export default class WebpackBaseConfig {
|
||||
constructor(builder, options) {
|
||||
this.name = options.name
|
||||
@ -156,6 +158,9 @@ export default class WebpackBaseConfig {
|
||||
},
|
||||
output: {
|
||||
comments: /^\**!|@preserve|@license|@cc_on/
|
||||
},
|
||||
mangle: {
|
||||
reserved: reservedVueTags
|
||||
}
|
||||
}
|
||||
}, this.options.build.terser))
|
||||
|
3
packages/webpack/src/utils/index.js
Normal file
3
packages/webpack/src/utils/index.js
Normal file
@ -0,0 +1,3 @@
|
||||
export { default as PerfLoader } from './perf-loader'
|
||||
export { default as StyleLoader } from './style-loader'
|
||||
export { reservedVueTags } from './reserved-tags'
|
23
packages/webpack/src/utils/reserved-tags.js
Normal file
23
packages/webpack/src/utils/reserved-tags.js
Normal file
@ -0,0 +1,23 @@
|
||||
export const reservedVueTags = [
|
||||
// HTML tags
|
||||
'html', 'body', 'base', 'head', 'link', 'meta', 'style', 'title', 'address',
|
||||
'article', 'aside', 'footer', 'header', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6',
|
||||
'hgroup', 'nav', 'section', 'div', 'dd', 'dl', 'dt', 'figcaption', 'figure',
|
||||
'picture', 'hr', 'img', 'li', 'main', 'ol', 'p', 'pre', 'ul', 'a', 'b', 'abbr',
|
||||
'bdi', 'bdo', 'br', 'cite', 'code', 'data', 'dfn', 'em', 'i', 'kbd', 'mark',
|
||||
'q', 'rp', 'rt', 'rtc', 'ruby', 's', 'samp', 'small', 'span', 'strong', 'sub',
|
||||
'sup', 'time', 'u', 'var', 'wbr', 'area', 'audio', 'map', 'track', 'video',
|
||||
'embed', 'object', 'param', 'source', 'canvas', 'script', 'noscript', 'del',
|
||||
'ins', 'caption', 'col', 'colgroup', 'table', 'thead', 'tbody', 'td', 'th', 'tr',
|
||||
'button', 'datalist', 'fieldset', 'form', 'input', 'label', 'legend', 'meter',
|
||||
'optgroup', 'option', 'output', 'progress', 'select', 'textarea', 'details',
|
||||
'dialog', 'menu', 'menuitem', 'summary', 'content', 'element', 'shadow', 'template',
|
||||
'blockquote', 'iframe', 'tfoot',
|
||||
// SVG tags
|
||||
'svg', 'animate', 'circle', 'clippath', 'cursor', 'defs', 'desc', 'ellipse', 'filter',
|
||||
'font-face', 'foreignObject', 'g', 'glyph', 'image', 'line', 'marker', 'mask',
|
||||
'missing-glyph', 'path', 'pattern', 'polygon', 'polyline', 'rect', 'switch', 'symbol',
|
||||
'text', 'textpath', 'tspan', 'use', 'view',
|
||||
// Vue built-in tags
|
||||
'slot', 'component'
|
||||
]
|
Loading…
Reference in New Issue
Block a user