diff --git a/config/dev.js b/config/dev.js index 0377634..a5e1058 100644 --- a/config/dev.js +++ b/config/dev.js @@ -4,6 +4,6 @@ module.exports = { }, defineConstants: { }, - weapp: {}, + mini: {}, h5: {} -} +}; diff --git a/config/index.js b/config/index.js index be53fba..a0a0a13 100644 --- a/config/index.js +++ b/config/index.js @@ -9,60 +9,31 @@ const config = { }, sourceRoot: 'src', outputRoot: 'dist', - plugins: { - babel: { - sourceMap: true, - presets: [ - ['env', { - modules: false - }] - ], - plugins: [ - 'transform-decorators-legacy', - 'transform-class-properties', - 'transform-object-rest-spread' - ] - } - }, - defineConstants: { - }, - copy: { - patterns: [ + babel: { + sourceMap: true, + presets: [ + ['env', { + modules: false + }] ], - options: { - } + plugins: [ + 'transform-decorators-legacy', + 'transform-class-properties', + 'transform-object-rest-spread' + ] }, - weapp: { - module: { - postcss: { - autoprefixer: { - enable: true, - config: { - browsers: [ - 'last 3 versions', - 'Android >= 4.1', - 'ios >= 8' - ] - } - }, - pxtransform: { - enable: true, - config: { - - } - }, - url: { - enable: true, - config: { - limit: 10240 // 设定转换尺寸上限 - } - }, - cssModules: { - enable: false, // 默认为 false,如需使用 css modules 功能,则设为 true - config: { - namingPattern: 'module', // 转换模式,取值为 global/module - generateScopedName: '[name]__[local]___[hash:base64:5]' - } + mini: { + webpackChain (chain, webpack) {}, + cssLoaderOption: {}, + postcss: { + pxtransform: { + enable: true, + config: {} + }, + url: { + enable: true, + config: { + limit: 10240 // 设定转换尺寸上限 } } } @@ -70,24 +41,16 @@ const config = { h5: { publicPath: '/', staticDirectory: 'static', - module: { - postcss: { - autoprefixer: { - enable: true, - config: { - browsers: [ - 'last 3 versions', - 'Android >= 4.1', - 'ios >= 8' - ] - } - }, - cssModules: { - enable: false, // 默认为 false,如需使用 css modules 功能,则设为 true - config: { - namingPattern: 'module', // 转换模式,取值为 global/module - generateScopedName: '[name]__[local]___[hash:base64:5]' - } + webpackChain (chain, webpack) {}, + postcss: { + autoprefixer: { + enable: true, + config: { + browsers: [ + 'last 3 versions', + 'Android >= 4.1', + 'ios >= 8' + ] } } } @@ -99,10 +62,10 @@ if (process.env.TARO_BUILD_TYPE === 'ui') { enableSourceMap: false, enableExtract: false, enableDll: false - }) + }); config.h5.webpackChain = chain => { - chain.plugins.delete('htmlWebpackPlugin') - chain.plugins.delete('addAssetHtmlWebpackPlugin') + chain.plugins.delete('htmlWebpackPlugin'); + chain.plugins.delete('addAssetHtmlWebpackPlugin'); chain.merge({ output: { path: path.join(process.cwd(), 'dist', 'h5'), @@ -126,4 +89,4 @@ module.exports = function (merge) { return merge({}, config, require('./dev')) } return merge({}, config, require('./prod')) -} +}; diff --git a/config/prod.js b/config/prod.js index c6a1531..2fda94b 100644 --- a/config/prod.js +++ b/config/prod.js @@ -4,7 +4,7 @@ module.exports = { }, defineConstants: { }, - weapp: {}, + mini: {}, h5: { /** * 如果h5端编译后体积过大,可以使用webpack-bundle-analyzer插件对打包体积进行分析。 @@ -15,4 +15,4 @@ module.exports = { * } */ } -} +}; diff --git a/package.json b/package.json index 77e474a..52285b0 100644 --- a/package.json +++ b/package.json @@ -1,83 +1,84 @@ { - "name": "taro-cropper", - "version": "1.1.0", - "private": false, - "description": "Taro框架下的图片裁剪组件封装,开箱即用", - "main": "dist/index.js", - "main:h5": "dist/index.js", - "templateInfo": { - "name": "default", - "typescript": true, - "css": "sass" - }, - "types": "./@types/index.d.ts", - "scripts": { - "build:weapp": "taro build --type weapp", - "build:swan": "taro build --type swan", - "build:alipay": "taro build --type alipay", - "build:tt": "taro build --type tt", - "build:h5": "taro build --type h5", - "build:rn": "taro build --type rn", - "build:qq": "taro build --type qq", - "build:quickapp": "taro build --type quickapp", - "dev:weapp": "npm run build:weapp -- --watch", - "dev:swan": "npm run build:swan -- --watch", - "dev:alipay": "npm run build:alipay -- --watch", - "dev:tt": "npm run build:tt -- --watch", - "dev:h5": "npm run build:h5 -- --watch", - "dev:rn": "npm run build:rn -- --watch", - "dev:qq": "npm run build:qq -- --watch", - "dev:quickapp": "npm run build:quickapp -- --watch", - "build:ui": "TARO_BUILD_TYPE=ui taro build --ui" - }, - "author": "SunnyQjm", - "license": "MIT", - "dependencies": {}, - "devDependencies": { - "@tarojs/components-qa": "^1.3.25", - "@tarojs/cli": "1.3.25", - "@tarojs/components": "1.3.25", - "@tarojs/plugin-babel": "1.3.25", - "@tarojs/plugin-csso": "1.3.25", - "@tarojs/plugin-sass": "1.3.25", - "@tarojs/plugin-uglifyjs": "1.3.25", - "@tarojs/router": "1.3.25", - "@tarojs/taro": "1.3.25", - "@tarojs/taro-alipay": "1.3.25", - "@tarojs/taro-h5": "1.3.25", - "@tarojs/taro-qq": "1.3.25", - "@tarojs/taro-quickapp": "1.3.25", - "@tarojs/taro-swan": "1.3.25", - "@tarojs/taro-tt": "1.3.25", - "@tarojs/taro-weapp": "1.3.25", - "@tarojs/webpack-runner": "1.3.25", - "@types/react": "^16.4.6", - "@types/webpack-env": "^1.13.6", - "@typescript-eslint/parser": "^1.6.0", - "babel-eslint": "^8.2.3", - "babel-plugin-transform-class-properties": "^6.24.1", - "babel-plugin-transform-decorators-legacy": "^1.3.4", - "babel-plugin-transform-jsx-stylesheet": "^0.6.5", - "babel-plugin-transform-object-rest-spread": "^6.26.0", - "babel-preset-env": "^1.6.1", - "eslint": "^5.16.0", - "eslint-config-taro": "1.3.25", - "eslint-plugin-import": "^2.12.0", - "eslint-plugin-react": "^7.8.2", - "eslint-plugin-react-hooks": "^1.6.1", - "eslint-plugin-taro": "1.3.25", - "hap-toolkit": "^0.6.6", - "nerv-devtools": "^1.5.5", - "nervjs": "^1.5.5", - "stylelint": "9.3.0", - "stylelint-config-taro-rn": "1.3.25", - "stylelint-taro-rn": "1.3.25", - "typescript": "^3.0.1" - }, - "files": [ - "dist", - "src", - "@types", - "README.md" - ] + "name": "taro-cropper", + "version": "1.1.0", + "private": false, + "description": "Taro框架下的图片裁剪组件封装,开箱即用", + "main": "dist/index.js", + "main:h5": "dist/index.js", + "templateInfo": { + "name": "default", + "typescript": true, + "css": "sass" + }, + "types": "./@types/index.d.ts", + "scripts": { + "build:weapp": "taro build --type weapp", + "build:swan": "taro build --type swan", + "build:alipay": "taro build --type alipay", + "build:tt": "taro build --type tt", + "build:h5": "taro build --type h5", + "build:rn": "taro build --type rn", + "build:qq": "taro build --type qq", + "build:quickapp": "taro build --type quickapp", + "dev:weapp": "npm run build:weapp -- --watch", + "dev:swan": "npm run build:swan -- --watch", + "dev:alipay": "npm run build:alipay -- --watch", + "dev:tt": "npm run build:tt -- --watch", + "dev:h5": "npm run build:h5 -- --watch", + "dev:rn": "npm run build:rn -- --watch", + "dev:qq": "npm run build:qq -- --watch", + "dev:quickapp": "npm run build:quickapp -- --watch", + "build:ui": "TARO_BUILD_TYPE=ui taro build --ui" + }, + "author": "SunnyQjm", + "license": "MIT", + "dependencies": {}, + "devDependencies": { + "@tarojs/cli": "2.0.4", + "@tarojs/components": "2.0.4", + "@tarojs/components-qa": "2.0.4", + "@tarojs/mini-runner": "^2.0.4", + "@tarojs/plugin-babel": "2.0.4", + "@tarojs/plugin-csso": "2.0.4", + "@tarojs/plugin-sass": "2.0.4", + "@tarojs/plugin-uglifyjs": "2.0.4", + "@tarojs/router": "2.0.4", + "@tarojs/taro": "2.0.4", + "@tarojs/taro-alipay": "2.0.4", + "@tarojs/taro-h5": "2.0.4", + "@tarojs/taro-qq": "2.0.4", + "@tarojs/taro-quickapp": "2.0.4", + "@tarojs/taro-swan": "2.0.4", + "@tarojs/taro-tt": "2.0.4", + "@tarojs/taro-weapp": "2.0.4", + "@tarojs/webpack-runner": "2.0.4", + "@types/react": "^16.4.6", + "@types/webpack-env": "^1.13.6", + "@typescript-eslint/parser": "^1.6.0", + "babel-eslint": "^8.2.3", + "babel-plugin-transform-class-properties": "^6.24.1", + "babel-plugin-transform-decorators-legacy": "^1.3.4", + "babel-plugin-transform-jsx-stylesheet": "^0.6.5", + "babel-plugin-transform-object-rest-spread": "^6.26.0", + "babel-preset-env": "^1.6.1", + "eslint": "^5.16.0", + "eslint-config-taro": "2.0.4", + "eslint-plugin-import": "^2.12.0", + "eslint-plugin-react": "^7.8.2", + "eslint-plugin-react-hooks": "^1.6.1", + "eslint-plugin-taro": "2.0.4", + "hap-toolkit": "^0.6.6", + "nerv-devtools": "^1.5.6", + "nervjs": "^1.5.6", + "stylelint": "9.3.0", + "stylelint-config-taro-rn": "2.0.4", + "stylelint-taro-rn": "2.0.4", + "typescript": "^3.0.1" + }, + "files": [ + "dist", + "src", + "@types", + "README.md" + ] }