diff --git a/packages/taro-components/package.json b/packages/taro-components/package.json index 22018439618c..1f4ff4e5ba0c 100644 --- a/packages/taro-components/package.json +++ b/packages/taro-components/package.json @@ -31,13 +31,7 @@ "classnames": "^2.2.5", "nervjs": "^1.3.0", "omit.js": "^1.0.0", - "weui": "^1.1.2" - }, - "peerDependencies": { - "@types/react": "^16.4.6", - "classnames": "^2.2.5", - "nervjs": "^1.3.0", - "omit.js": "^1.0.0", + "swiper": "^4.4.2", "weui": "^1.1.2" }, "devDependencies": { @@ -47,12 +41,12 @@ "@babel/plugin-transform-react-jsx": "^7.0.0", "@babel/preset-env": "^7.1.5", "@tarojs/taro-h5": "1.2.8", + "@types/react": "^16.4.6", "babel-core": "^7.0.0-bridge.0", "babel-jest": "^22.4.4", "babel-loader": "^8.0.5", "jest": "^22.4.4", "nerv-test-utils": "^1.2.18", - "swiper": "^4.4.2", "webpack": "^3.11.0", "webpack-cli": "^1.0.12", "webpack-dev-server": "^3.1.14" diff --git a/packages/taro-webpack-runner/package.json b/packages/taro-webpack-runner/package.json index c786874188dc..0af1cc4bcd5e 100644 --- a/packages/taro-webpack-runner/package.json +++ b/packages/taro-webpack-runner/package.json @@ -47,7 +47,7 @@ "node-sass": "4.8.3", "opn": "5.3.0", "ora": "2.1.0", - "postcss-loader": "2.1.3", + "postcss-loader": "2.1.6", "postcss-plugin-constparse": "1.2.8", "postcss-pxtransform": "1.2.8", "resolve": "1.8.1", diff --git a/packages/taro-webpack-runner/src/config/base.conf.ts b/packages/taro-webpack-runner/src/config/base.conf.ts index 6881e04c7cce..62e9e89e4685 100644 --- a/packages/taro-webpack-runner/src/config/base.conf.ts +++ b/packages/taro-webpack-runner/src/config/base.conf.ts @@ -1,7 +1,7 @@ import * as path from 'path' import * as Chain from 'webpack-chain' -import { getRootPath } from '../util' +import { getRootPath, appPath } from '../util' import { getBabelLoader, getUrlLoader, @@ -47,7 +47,10 @@ export default () => { extensions: ['.js', '.jsx', '.ts', '.tsx'], mainFields: ['main', 'module'], symlinks: true, - modules: [path.join(getRootPath(), 'node_modules'), 'node_modules'] + modules: [ + 'node_modules', + path.join(appPath, 'node_modules') + ] }, resolveLoader: { modules: [path.join(getRootPath(), 'node_modules')] diff --git a/packages/taro-webpack-runner/src/util/chain.ts b/packages/taro-webpack-runner/src/util/chain.ts index 646d8fcb455c..f7e432326c2e 100644 --- a/packages/taro-webpack-runner/src/util/chain.ts +++ b/packages/taro-webpack-runner/src/util/chain.ts @@ -335,7 +335,10 @@ const getModule = ({ const isNodemodule = filename => /\bnode_modules\b/.test(filename) if (Array.isArray(esnextModules) && esnextModules.length) { /* cnpm 安装的模块名前带下划线 `_` */ - const esnextModuleRegs = esnextModules.map(v => new RegExp(`node_modules[\\\\/]_?${v}`)); + const esnextModuleRegs = [ + /@tarojs\/components/, + ...esnextModules.map(v => new RegExp(`node_modules[\\\\/]_?${v}`)) + ] /** * isEsnextModule *