From 18fce6629ff294533a02a08966173647b74d725d Mon Sep 17 00:00:00 2001 From: leslieder Date: Tue, 4 Jan 2022 16:52:55 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=89=93=E5=8C=85=E5=86=85?= =?UTF-8?q?=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- examples/css.html | 2 +- examples/expression.html | 2 +- examples/modules/mrepeat.js | 4 ++- examples/repeat.html | 2 +- extend/elementinit.ts | 2 +- rollup.config.js | 58 +++++++++++++++++++++---------------- 6 files changed, 40 insertions(+), 30 deletions(-) diff --git a/examples/css.html b/examples/css.html index 6fea15c..2ef5c7b 100644 --- a/examples/css.html +++ b/examples/css.html @@ -10,7 +10,7 @@
hahaha
diff --git a/extend/elementinit.ts b/extend/elementinit.ts index 8bd35e1..75b751c 100644 --- a/extend/elementinit.ts +++ b/extend/elementinit.ts @@ -37,7 +37,6 @@ class FOR extends DefineElement{ node.addDirective(new Directive('repeat',cond)); } } - /** * 递归元素 */ @@ -110,4 +109,5 @@ class SLOT extends DefineElement{ node.addDirective(new Directive('slot',cond)); } } + DefineElementManager.add([MODULE,FOR,IF,RECUR,ELSE,ELSEIF,ENDIF,SLOT]); \ No newline at end of file diff --git a/rollup.config.js b/rollup.config.js index 23139f8..246f3ec 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -2,42 +2,47 @@ import commonjs from "@rollup/plugin-commonjs"; import nodeResolve from "@rollup/plugin-node-resolve"; import path from "path"; import ts from "rollup-plugin-typescript2"; -import {terser} from "rollup-plugin-terser"; +import { + terser +} from "rollup-plugin-terser"; +const commonOpt = { + name: 'nodom', + sourcemap: true + }, + pluginOpt = { + ...commonOpt, + plugins: [terser({ + keep_classnames: true, + })], + }; + export default { input: path.join(__dirname, "/index.ts"), - output:[ - { - name: "nodom", - file: path.resolve("dist/nodom.esm.js"), - format: "esm", - sourcemap: true + output: [{ + file: resolve('nodom.esm.js'), + format: "esm", + ...commonOpt }, { - name: "nodom", - file: path.resolve("dist/nodom.esm.min.js"), - format: "esm", - sourcemap: true, - plugins:[terser()] + file: resolve("nodom.esm.min.js"), + format: "esm", + ...pluginOpt }, { - name: "nodom", - file: path.resolve("dist/nodom.cjs.js"), + file: resolve("nodom.cjs.js"), format: "cjs", - sourcemap: true, + ...commonOpt }, { - name: "nodom", - file: path.resolve("dist/nodom.cjs.min.js"), + file: resolve("nodom.cjs.min.js"), format: "cjs", - sourcemap: true, - plugins:[terser()] - },{ - name: "nodom", - file: path.resolve("dist/nodom.global.js"), - format: "iife", - sourcemap: true, + ...pluginOpt + }, { + file: resolve("nodom.global.js"), + format: "iife", + ...commonOpt } - ] , + ], plugins: [ nodeResolve({ extensions: [".js", ".ts"], @@ -46,3 +51,6 @@ export default { commonjs(), ], }; +function resolve(name) { + return path.resolve(`dist/${name}`); +} \ No newline at end of file -- Gitee