Commit f13ae869 authored by rockyl's avatar rockyl

压缩代码抛出错误

parent 4d6d677e
......@@ -8,9 +8,9 @@ import { generateLibraryScriptEl, generateJsScriptEl, fillTemplate } from 'zeroi
*/
async function compile(source, debug = false) {
let output = ts.transpileModule(source, {compilerOptions: {
}});
let output = ts.transpileModule(source, {
compilerOptions: {}
});
const result = {
code: output.outputText,
......@@ -23,7 +23,9 @@ async function compile(source, debug = false) {
function uglify(source) {
const uglifyResult = UglifyJS.minify(source, {});
if (!uglifyResult.error) {
if (uglifyResult.error) {
throw new Error(uglifyResult.error);
} else {
return uglifyResult.code;
}
}
......
This diff is collapsed.
......@@ -14,9 +14,9 @@ var zeroingTemplateFill = require('zeroing-template-fill');
*/
async function compile(source, debug = false) {
let output = ts.transpileModule(source, {compilerOptions: {
}});
let output = ts.transpileModule(source, {
compilerOptions: {}
});
const result = {
code: output.outputText,
......@@ -29,7 +29,9 @@ async function compile(source, debug = false) {
function uglify(source) {
const uglifyResult = UglifyJS.minify(source, {});
if (!uglifyResult.error) {
if (uglifyResult.error) {
throw new Error(uglifyResult.error);
} else {
return uglifyResult.code;
}
}
......
This diff is collapsed.
......@@ -12,9 +12,9 @@
*/
async function compile(source, debug = false) {
let output = ts.transpileModule(source, {compilerOptions: {
}});
let output = ts.transpileModule(source, {
compilerOptions: {}
});
const result = {
code: output.outputText,
......@@ -27,7 +27,9 @@
function uglify(source) {
const uglifyResult = UglifyJS.minify(source, {});
if (!uglifyResult.error) {
if (uglifyResult.error) {
throw new Error(uglifyResult.error);
} else {
return uglifyResult.code;
}
}
......
This diff is collapsed.
......@@ -6,9 +6,9 @@ import ts from 'typescript';
import UglifyJS from 'uglify-js';
export async function compile(source, debug = false) {
let output = ts.transpileModule(source, {compilerOptions: {
}});
let output = ts.transpileModule(source, {
compilerOptions: {}
});
const result = {
code: output.outputText,
......@@ -21,7 +21,9 @@ export async function compile(source, debug = false) {
export function uglify(source) {
const uglifyResult = UglifyJS.minify(source, {});
if (!uglifyResult.error) {
if (uglifyResult.error) {
throw new Error(uglifyResult.error);
} else {
return uglifyResult.code;
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment