Skip to content

Commit 366202f

Browse files
committed
fix entity-decoder build config
1 parent eb92723 commit 366202f

File tree

4 files changed

+11
-17
lines changed

4 files changed

+11
-17
lines changed

build/config.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ const builds = {
2525
entry: path.resolve(__dirname, '../src/entries/web-runtime.js'),
2626
dest: path.resolve(__dirname, '../dist/vue.runtime.js'),
2727
format: 'umd',
28+
env: 'development',
2829
banner
2930
},
3031
// runtime-only production build for CDN
@@ -41,6 +42,7 @@ const builds = {
4142
dest: path.resolve(__dirname, '../dist/vue.js'),
4243
format: 'umd',
4344
env: 'development',
45+
alias: { he: './entity-decoder' },
4446
banner
4547
},
4648
// Runtime+compiler standalone production build.
@@ -49,6 +51,7 @@ const builds = {
4951
dest: path.resolve(__dirname, '../dist/vue.min.js'),
5052
format: 'umd',
5153
env: 'production',
54+
alias: { he: './entity-decoder' },
5255
banner
5356
},
5457
// Web compiler (CommonJS).
@@ -91,7 +94,7 @@ function genConfig (opts) {
9194
plugins: [
9295
flow(),
9396
buble(),
94-
alias(require('./alias'))
97+
alias(Object.assign({}, require('./alias'), opts.alias))
9598
]
9699
}
97100

src/compiler/parser/entity-decoder.js

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,9 @@
11
/* @flow */
22

3-
import { inBrowser } from 'core/util/env'
3+
let decoder
44

5-
let decode
6-
7-
/* istanbul ignore else */
8-
if (inBrowser) {
9-
const decoder = document.createElement('div')
10-
decode = (html: string): string => {
11-
decoder.innerHTML = html
12-
return decoder.textContent
13-
}
14-
} else {
15-
decode = require('he').decode
5+
export function decode (html: string): string {
6+
decoder = decoder || document.createElement('div')
7+
decoder.innerHTML = html
8+
return decoder.textContent
169
}
17-
18-
export { decode }

src/compiler/parser/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* @flow */
22

3-
import { decode } from './entity-decoder'
3+
import { decode } from 'he'
44
import { parseHTML } from './html-parser'
55
import { parseText } from './text-parser'
66
import { cached, no, camelize } from 'shared/util'

src/platforms/weex/runtime/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Vue.config.mustUseProp = mustUseProp
1616
Vue.options.directives = platformDirectives
1717

1818
// install platform patch function
19-
Vue.prototype.__patch__ = config._isServer ? noop : patch
19+
Vue.prototype.__patch__ = patch
2020

2121
// wrap mount
2222
Vue.prototype.$mount = function (

0 commit comments

Comments
 (0)