diff --git a/build/scripts.js b/build/scripts.js index a6c9641..f394342 100644 --- a/build/scripts.js +++ b/build/scripts.js @@ -21,7 +21,7 @@ module.exports = exports = async function scripts (prod) { const files = await Promise.map(glob('js/*.{js,jsx}', { cwd: ROOT, nodir: true }), async (filepath) => { const f = new ClientScript(filepath); - if (f.globalScript) return false; + if (f.preprocessed) return false; await f.load(prod); @@ -31,7 +31,6 @@ module.exports = exports = async function scripts (prod) { const tasks = files.map((f) => f.tasks()).flat(); tasks.push(...globalScript.tasks()); - return tasks; }; @@ -41,13 +40,6 @@ class ClientScript extends File { _basename (file) { super._basename(file); - this.globalScript = false; - if (file.name[0] === '_') { - this.globalScript = true; - file.name = file.name.slice(1); - file.base = file.base.slice(1); - } - this.rollup = false; if (file.name[0] === '$') { this.rollup = true; @@ -69,7 +61,7 @@ class ClientScript extends File { let contents = (await readFile(this.input).catch(() => '')).toString('utf8'); if (prod) { - const { code, error } = minify(contents); + const { code, error } = minify(contents, { output: { comments: false } }); if (error) throw new Error(error); contents = code; } @@ -80,7 +72,7 @@ class ClientScript extends File { let contents = await Promise.map(files, readFile); contents = contents.join('\n\n'); if (prod) { - const { code, error } = minify(contents); + const { code, error } = minify(contents, { output: { comments: false } }); if (error) throw new Error(error); contents = code; } @@ -88,7 +80,7 @@ class ClientScript extends File { } tasks () { - + if (this.preprocessed) return []; return [ { input: this.input, output: this.out,