diff --git a/config/index.js b/config/index.js index 8b4e8ed54..bc3aa7939 100644 --- a/config/index.js +++ b/config/index.js @@ -9,12 +9,10 @@ const config = { designWidth: 750, sourceRoot: 'src', outputRoot: isBuildComponent ? 'dist' : `dist/${process.env.TARO_ENV}`, - plugins: {}, + plugins: ['@tarojs/plugin-sass', '@tarojs/plugin-uglify'], babel: { sourceMap: true, - presets: [ - 'env' - ], + presets: ['env'], plugins: [ 'transform-class-properties', 'transform-decorators-legacy', @@ -23,7 +21,7 @@ const config = { }, defineConstants: {}, alias: { - 'taro-ui': path.resolve(__dirname, '../src/ui.ts'), + 'taro-ui': path.resolve(__dirname, '../src/ui.ts') }, mini: {}, h5: { @@ -33,7 +31,7 @@ const config = { enable: true } } - }, + } } if (isBuildComponent) { @@ -57,22 +55,24 @@ if (isBuildComponent) { classnames: 'commonjs2 classnames', '@tarojs/components': 'commonjs2 @tarojs/components', '@tarojs/taro-h5': 'commonjs2 @tarojs/taro-h5', - 'weui': 'commonjs2 weui' + weui: 'commonjs2 weui' }, plugin: { extractCSS: { plugin: MiniCssExtractPlugin, - args: [{ - filename: 'css/index.css', - chunkFilename: 'css/[id].css' - }] + args: [ + { + filename: 'css/index.css', + chunkFilename: 'css/[id].css' + } + ] } } }) } } -module.exports = function (merge) { +module.exports = function(merge) { if (process.env.NODE_ENV === 'development') { return merge({}, config, require('./dev')) } diff --git a/package.json b/package.json index 5b582a31d..be8cbe39a 100644 --- a/package.json +++ b/package.json @@ -199,7 +199,7 @@ "build:h5": "taro build --type h5", "build:swan": "taro build --type swan", "build:alipay": "taro build --type alipay", - "build:component": "cross-env TARO_BUILD_TYPE=component taro build --ui", + "build:component": "cross-env TARO_BUILD_TYPE=component taro build --ui --uiIndex ui", "build:h5-static": "yarn run build:h5 && node ./build/build-static", "build:doc": "yarn run build:h5-static && node ./build/build-docs", "prepublishOnly": "yarn run clean && yarn run build:component", @@ -234,7 +234,7 @@ "@tarojs/plugin-babel": "^2.0.3", "@tarojs/plugin-csso": "^2.0.3", "@tarojs/plugin-sass": "^2.0.3", - "@tarojs/plugin-uglifyjs": "^2.0.3", + "@tarojs/plugin-uglify": "^2.2.10", "@tarojs/router": "^2.0.3", "@tarojs/taro": "^2.0.3", "@tarojs/taro-alipay": "^2.0.3",