Skip to content

Commit

Permalink
fix(components webpack-runner): components打包问题修复
Browse files Browse the repository at this point in the history
- components添加swiper依赖
- 为components添加源码编译功能
- 修复webpack-runner寻找依赖的路径错误
  • Loading branch information
Littly committed Jan 28, 2019
1 parent 3a9cbe8 commit d0f5732
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
10 changes: 2 additions & 8 deletions packages/taro-components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand All @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion packages/taro-webpack-runner/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
7 changes: 5 additions & 2 deletions packages/taro-webpack-runner/src/config/base.conf.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -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')]
Expand Down
5 changes: 4 additions & 1 deletion packages/taro-webpack-runner/src/util/chain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down

0 comments on commit d0f5732

Please sign in to comment.