From a98ed9df61b2320450470acdfc516f273bcd5193 Mon Sep 17 00:00:00 2001 From: caihuanyu Date: Sun, 25 Aug 2019 21:59:58 +0800 Subject: [PATCH] =?UTF-8?q?build:=20build=E5=89=8D=E6=B8=85=E7=90=86?= =?UTF-8?q?=E8=BE=93=E5=87=BA=E7=9B=AE=E5=BD=95=EF=BC=8C=E5=B9=B6=E4=BF=9D?= =?UTF-8?q?=E7=95=99.tea=E4=B8=8D=E5=88=A0=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit resolve #132 --- packages/remax-cli/package.json | 1 + packages/remax-cli/src/build/rollupConfig.ts | 13 ++++--------- packages/remax-cli/typings/index.d.ts | 2 +- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/packages/remax-cli/package.json b/packages/remax-cli/package.json index db07d4732..4f9c50d2a 100644 --- a/packages/remax-cli/package.json +++ b/packages/remax-cli/package.json @@ -37,6 +37,7 @@ "rollup-plugin-clear": "^2.0.7", "rollup-plugin-commonjs": "^10.0.0", "rollup-plugin-copy": "^3.1.0", + "rollup-plugin-delete": "^1.1.0", "rollup-plugin-json": "^4.0.0", "rollup-plugin-node-resolve": "^5.0.3", "rollup-plugin-progress": "^1.1.1", diff --git a/packages/remax-cli/src/build/rollupConfig.ts b/packages/remax-cli/src/build/rollupConfig.ts index 573fecc80..a25e99265 100644 --- a/packages/remax-cli/src/build/rollupConfig.ts +++ b/packages/remax-cli/src/build/rollupConfig.ts @@ -7,7 +7,7 @@ import url from 'rollup-plugin-url'; import json from 'rollup-plugin-json'; import postcss from '@meck/rollup-plugin-postcss'; import progress from 'rollup-plugin-progress'; -import clear from 'rollup-plugin-clear'; +import clean from 'rollup-plugin-delete'; import alias from 'rollup-plugin-alias'; import copy from 'rollup-plugin-copy'; import stub from './plugins/stub'; @@ -72,6 +72,9 @@ export default function rollupConfig( const cssModuleConfig = getCssModuleConfig(options.cssModules); const plugins = [ + clean({ + targets: ['dist/*', '!.tea'], + }), copy({ targets: [ { @@ -214,14 +217,6 @@ export default function rollupConfig( plugins.push(progress()); } - if (!argv.watch) { - plugins.unshift( - clear({ - targets: options.output, - }) - ); - } - const config: RollupOptions = { input: [entries.app, ...entries.pages.map(p => p.file)], output: { diff --git a/packages/remax-cli/typings/index.d.ts b/packages/remax-cli/typings/index.d.ts index dbcd1bc33..1e2802af0 100644 --- a/packages/remax-cli/typings/index.d.ts +++ b/packages/remax-cli/typings/index.d.ts @@ -3,7 +3,7 @@ declare module '@meck/rollup-plugin-postcss'; declare module 'rollup-plugin-json'; declare module 'rollup-plugin-node-resolve'; declare module 'rollup-plugin-progress'; -declare module 'rollup-plugin-clear'; +declare module 'rollup-plugin-delete'; declare module 'rollup-plugin-alias'; declare module 'rollup-plugin-url'; declare module 'rollup-plugin-typescript';