mirror of
https://github.com/vuejs/vue.git
synced 2024-11-22 04:39:46 +00:00
build: fix compiler build
This commit is contained in:
parent
2ddd25926e
commit
cda5176e95
@ -42,7 +42,7 @@ import { warnOnce } from './warn'
|
||||
import { isReservedTag } from 'web/util'
|
||||
import { dirRE } from 'compiler/parser'
|
||||
import { parseText } from 'compiler/parser/text-parser'
|
||||
import { DEFAULT_FILENAME } from './parse'
|
||||
import { DEFAULT_FILENAME } from './parseComponent'
|
||||
|
||||
// Special compiler macros
|
||||
const DEFINE_PROPS = 'defineProps'
|
||||
|
@ -3,13 +3,13 @@ import { RawSourceMap, VueTemplateCompiler } from './types'
|
||||
import {
|
||||
parseComponent,
|
||||
VueTemplateCompilerParseOptions,
|
||||
SFCDescriptor
|
||||
SFCDescriptor,
|
||||
DEFAULT_FILENAME
|
||||
} from './parseComponent'
|
||||
|
||||
import hash from 'hash-sum'
|
||||
import LRU from 'lru-cache'
|
||||
|
||||
export const DEFAULT_FILENAME = 'anonymous.vue'
|
||||
import { hmrShouldReload } from './compileScript'
|
||||
|
||||
const cache = new LRU<string, SFCDescriptor>(100)
|
||||
|
||||
@ -52,6 +52,8 @@ export function parse(options: ParseOptions): SFCDescriptor {
|
||||
}
|
||||
|
||||
output.filename = filename
|
||||
output.shouldForceReload = prevImports =>
|
||||
hmrShouldReload(prevImports, output!)
|
||||
|
||||
if (needMap) {
|
||||
if (output.script && !output.script.src) {
|
||||
|
@ -3,8 +3,9 @@ import { parseHTML } from 'compiler/parser/html-parser'
|
||||
import { makeMap } from 'shared/util'
|
||||
import { ASTAttr, WarningMessage } from 'types/compiler'
|
||||
import { BindingMetadata, RawSourceMap } from './types'
|
||||
import { hmrShouldReload, ImportBinding } from './compileScript'
|
||||
import { DEFAULT_FILENAME } from './parse'
|
||||
import type { ImportBinding } from './compileScript'
|
||||
|
||||
export const DEFAULT_FILENAME = 'anonymous.vue'
|
||||
|
||||
const splitRE = /\r?\n/g
|
||||
const replaceRE = /./g
|
||||
@ -84,7 +85,7 @@ export function parseComponent(
|
||||
styles: [],
|
||||
customBlocks: [],
|
||||
errors: [],
|
||||
shouldForceReload: prevImports => hmrShouldReload(prevImports, sfc)
|
||||
shouldForceReload: null as any // attached in parse() by compiler-sfc
|
||||
}
|
||||
let depth = 0
|
||||
let currentBlock: SFCBlock | null = null
|
||||
|
@ -211,7 +211,6 @@ const builds = {
|
||||
entry: resolve('packages/compiler-sfc/src/index.ts'),
|
||||
dest: resolve('packages/compiler-sfc/dist/compiler-sfc.js'),
|
||||
format: 'cjs',
|
||||
transpile: false,
|
||||
external: Object.keys(
|
||||
require('../packages/compiler-sfc/package.json').dependencies
|
||||
),
|
||||
@ -251,7 +250,10 @@ function genConfig(name) {
|
||||
compilerOptions: {
|
||||
// if targeting browser, target es5
|
||||
// if targeting node, es2017 means Node 8
|
||||
target: opts.transpile === false ? 'es2017' : 'es5'
|
||||
target:
|
||||
opts.transpile === false || opts.format === 'cjs'
|
||||
? 'es2017'
|
||||
: 'es5'
|
||||
},
|
||||
exclude: ['test', 'test-dts']
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user