如题 难道是 webpack 的新特性
{
"name": "admin",
"version": "0.1.0",
"private": true,
"dependencies": {
"autoprefixer": "7.1.1",
"babel-core": "6.25.0",
"babel-eslint": "7.2.3",
"babel-jest": "20.0.3",
"babel-loader": "7.0.0",
"babel-preset-react-app": "^3.0.1",
"babel-runtime": "6.23.0",
"case-sensitive-paths-webpack-plugin": "2.1.1",
"chalk": "1.1.3",
"css-loader": "0.28.4",
"dotenv": "4.0.0",
"eslint": "3.19.0",
"eslint-config-react-app": "^1.0.5",
"eslint-loader": "1.7.1",
"eslint-plugin-flowtype": "2.34.0",
"eslint-plugin-import": "2.2.0",
"eslint-plugin-jsx-a11y": "5.0.3",
"eslint-plugin-react": "7.1.0",
"extract-text-webpack-plugin": "2.1.2",
"file-loader": "0.11.2",
"fs-extra": "3.0.1",
"html-webpack-plugin": "2.29.0",
"jest": "20.0.4",
"object-assign": "4.1.1",
"postcss-flexbugs-fixes": "3.0.0",
"postcss-loader": "2.0.6",
"promise": "7.1.1",
"react": "^15.6.1",
"react-dev-utils": "^3.0.2",
"react-dom": "^15.6.1",
"react-error-overlay": "^1.0.9",
"style-loader": "0.18.2",
"sw-precache-webpack-plugin": "0.11.3",
"url-loader": "0.5.9",
"webpack": "2.6.1",
"webpack-dev-server": "2.5.0",
"webpack-manifest-plugin": "1.1.0",
"whatwg-fetch": "2.0.3"
},
"scripts": {
"start": "node scripts/start.js",
"build": "node scripts/build.js",
"test": "node scripts/test.js --env=jsdom"
},
"jest": {
"collectCoverageFrom": [
"src/**/*.{js,jsx}"
],
"setupFiles": [
"<rootDir>/config/polyfills.js"
],
"testMatch": [
"<rootDir>/src/**/__tests__/**/*.js?(x)",
"<rootDir>/src/**/?(*.)(spec|test).js?(x)"
],
"testEnvironment": "node",
"testURL": "http://localhost",
"transform": {
"^.+\\.(js|jsx)$": "<rootDir>/node_modules/babel-jest",
"^.+\\.css$": "<rootDir>/config/jest/cssTransform.js",
"^(?!.*\\.(js|jsx|css|json)$)": "<rootDir>/config/jest/fileTransform.js"
},
"transformIgnorePatterns": [
"[/\\\\]node_modules[/\\\\].+\\.(js|jsx)$"
],
"moduleNameMapper": {
"^react-native$": "react-native-web"
},
"moduleFileExtensions": [
"web.js",
"js",
"json",
"web.jsx",
"jsx"
]
},
"babel": {
"presets": [
"react-app"
]
},
"eslintConfig": {
"extends": "react-app"
}
}
1
kfll 2017-07-03 12:13:35 +08:00
很正常,没有一个模块是你运行的时候需要的,分到两组去没有必要
|
3
cliberal OP @kfll 之前创建的工程除了 react 核心模块在 dependencies 其他的都在 devDependencies 里
|
4
kfll 2017-07-03 12:52:23 +08:00 1
@cliberal
自从前端库大量进入 npm 之后,npm 的分组理念就不怎么好用了,你需要用最适合项目的方式去分组。 在这个解决方案里面,事情是这样的: 1. 首先要理解 react 和 webpack 分到两组去没有必要(两者均只在开发及构建阶段用到 2. 分到哪组去只是选择问题,问题都不是很大,以我经验来看,deps 是比较适合的: i. 感情上:没有运行阶段,构建是一等公民 ii. 减少约定:由于社区滥用 NODE_ENV,很可能构建脚本一开始或执行之前就设置了 NODE_ENV=production,默认情况下 devDeps 会被忽略,全都放 deps 能避免出错。 3. 真要分,建议构建依赖放 deps,测试依赖放 devDeps |
5
cliberal OP @kfll 感谢解答 查看了 eject 脚本的源码记录,在 1.0.8 版本将 devDependencies 改成了 dependencies,看来是不打算再使用 devDeps 了
|
6
quanruzhuoxiu 2019-01-23 11:19:48 +08:00
eslint 这种跟构建无关的呢?
|
7
ywUXm9U86a62N7rN 2019-07-22 15:31:54 +08:00
|