提交 a43698c4 编写于 作者: fxy060608's avatar fxy060608

wip(app): nvue

上级 d576ddcb
......@@ -19,13 +19,11 @@ const UniAppNVuePlugin = () => {
}
pagesJsonPath = uni_cli_shared_1.normalizePath(path_1.default.resolve(process.env.UNI_INPUT_DIR, 'pages.json'));
if (process.env.NODE_ENV === 'production') {
webpack_1.runWebpackBuild();
}
else {
webpack_1.runWebpackDev().then((compiler) => {
watching = compiler.watching;
});
return webpack_1.runWebpackBuild().then(() => { });
}
return webpack_1.runWebpackDev().then((compiler) => {
watching = compiler.watching;
});
},
configResolved() {
if (process.env.UNI_NVUE_COMPILER === 'vue') {
......@@ -53,10 +51,8 @@ const UniAppNVuePlugin = () => {
return;
}
const curNVueEntry = JSON.stringify(Object.keys(entry));
console.log('watchChange', lastNVueEntry, curNVueEntry);
if (curNVueEntry !== lastNVueEntry) {
lastNVueEntry = curNVueEntry;
console.log('invalidate');
watching.invalidate();
}
},
......
......@@ -18,12 +18,11 @@ const UniAppNVuePlugin = (): UniVitePlugin => {
path.resolve(process.env.UNI_INPUT_DIR, 'pages.json')
)
if (process.env.NODE_ENV === 'production') {
runWebpackBuild()
} else {
runWebpackDev().then((compiler) => {
watching = compiler.watching
})
return runWebpackBuild().then(() => {})
}
return runWebpackDev().then((compiler) => {
watching = compiler.watching
})
},
configResolved() {
if (process.env.UNI_NVUE_COMPILER === 'vue') {
......@@ -52,10 +51,8 @@ const UniAppNVuePlugin = (): UniVitePlugin => {
return
}
const curNVueEntry = JSON.stringify(Object.keys(entry))
console.log('watchChange', lastNVueEntry, curNVueEntry)
if (curNVueEntry !== lastNVueEntry) {
lastNVueEntry = curNVueEntry
console.log('invalidate')
watching.invalidate()
}
},
......
......@@ -16,11 +16,9 @@ function runWebpack(
if (err) {
return reject(err.stack || err)
}
if (stats!.hasErrors()) {
return reject(stats!.toString())
}
if (stats!.hasWarnings()) {
const info = stats!.toJson({ all: false, warnings: true })
console.warn(info.warnings)
......
......@@ -12,7 +12,7 @@ export const h5ServeFormatter: Formatter = {
const REMOVED_MSGS = [
'build started...',
(msg: string) => {
return msg.startsWith('built in ')
return /built in [0-9]+ms\./.test(msg)
},
'watching for file changes...',
]
......
......@@ -27,8 +27,8 @@ const initInfoFormattersOnce = once(() => {
) {
infoFormatters.push(h5ServeFormatter)
}
infoFormatters.push(removeInfoFormatter)
}
infoFormatters.push(removeInfoFormatter)
})
export function formatErrMsg(msg: string) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册