Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot resolve 'file' or 'directory' ./locale #75

Closed
woodccc opened this issue Oct 5, 2016 · 2 comments
Closed

Cannot resolve 'file' or 'directory' ./locale #75

woodccc opened this issue Oct 5, 2016 · 2 comments

Comments

@woodccc
Copy link

woodccc commented Oct 5, 2016

error

WARNING in ./~/antd/dist/antd.js
Module not found: Error: Cannot resolve 'file' or 'directory' ./locale in /Users/wood/workspace/mort-web/node_modules/antd/dist
 @ ./~/antd/dist/antd.js 8289:17-44

package.json

"devDependencies": {
    "babel": "5.8.34",
    "babel-core": "5.8.34",
    "babel-eslint": "4.1.8",
    "babel-loader": "5.4.0",
    "babel-plugin-import": "^1.0.1",
    "babel-plugin-react-transform": "1.1.1",
    "babel-polyfill": "6.3.14",
    "browser-sync": "2.10.0",
    "chai": "^3.5.0",
    "chalk": "1.1.1",
    "config": "1.17.1",
    "css-loader": "0.23.0",
    "del": "2.1.0",
    "enzyme": "^2.4.1",
    "escope": "3.3.0",
    "eslint": "1.10.3",
    "eslint-plugin-react": "4.3.0",
    "esrecurse": "4.0.0",
    "file-loader": "0.8.5",
    "force-case-sensitivity-webpack-plugin": "0.1.0",
    "gaze": "0.5.2",
    "imports-loader": "0.6.5",
    "jsdom": "^9.4.2",
    "json-loader": "^0.5.4",
    "jsx-loader": "0.13.2",
    "loader-utils": "0.2.12",
    "mocha": "^3.0.2",
    "nib": "1.1.0",
    "proxy-middleware": "0.15.0",
    "react-addons-test-utils": "^15.3.1",
    "react-transform-catch-errors": "1.0.0",
    "react-transform-hmr": "1.0.1",
    "redux-devtools": "3.2.0",
    "redux-devtools-dock-monitor": "1.1.1",
    "redux-devtools-log-monitor": "1.0.9",
    "require-dir": "0.3.0",
    "sinon": "^1.17.5",
    "style": "0.0.3",
    "style-loader": "0.13.0",
    "stylus": "0.52.4",
    "stylus-loader": "1.4.2",
    "unexpected": "^10.16.0",
    "unexpected-dom": "^3.1.0",
    "unexpected-sinon": "^10.4.0",
    "url-loader": "0.5.7",
    "vinyl-fs": "2.2.1",
    "webpack": "1.12.8",
    "webpack-dev-middleware": "1.2.0",
    "webpack-dev-server": "1.14.0",
    "webpack-hot-middleware": "2.5.0",
    "yargs": "3.30.0"
  }

webpack.config.js

{
 babel: {
    plugins: [['import', {
      libraryName: 'antd',
      libraryDirectory: "lib",
      style: 'css',
    }]]
  }
}

conponent

import { DatePicker } from 'antd'
@woodccc
Copy link
Author

woodccc commented Oct 5, 2016

不使用babel-plugin-import,也会这样报错:

WARNING in ./~/antd/dist/antd.js
Module not found: Error: Cannot resolve 'file' or 'directory' ./locale in /Users/wood/workspace/mort-web/node_modules/antd/dist
 @ ./~/antd/dist/antd.js 8289:17-44

@afc163
Copy link
Contributor

afc163 commented Oct 6, 2016

ant-design/ant-design#3204

另外,直接 import antd/dist/antd 是加载所有模块,那么 babel-plugin-import 按需加载功能就会失效。

@afc163 afc163 closed this as completed Oct 6, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants