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

Failed to resolve existing module rmc-steps #1422

Closed
FourLeafClover opened this issue May 23, 2018 · 14 comments
Closed

Failed to resolve existing module rmc-steps #1422

FourLeafClover opened this issue May 23, 2018 · 14 comments

Comments

@FourLeafClover
Copy link

FourLeafClover commented May 23, 2018

image

@lordGuan
Copy link

you may need babel in your project

@FourLeafClover
Copy link
Author

@lordGuan sames, where have some problems when i import antd-mobile。 I have npm install rmc-steps

image

@DeMoorJasper
Copy link
Member

DeMoorJasper commented May 23, 2018

Object spread is ES2018 not ES6 and a babel config is probably required. Although babel configs don't apply on node_modules I think

@FourLeafClover
Copy link
Author

@DeMoorJasper I added the babel。 but there have another problem。please see the previous image。

@DeMoorJasper
Copy link
Member

If the dependency is installed I'm not sure why it can't get resolved

@DeMoorJasper
Copy link
Member

An example repo or a bit more info would be helpfull. There is a bug template if you file an issue, would be nice if you use that to reformat the issue :)

@fathyb
Copy link
Contributor

fathyb commented May 25, 2018

@FourLeafClover did you try with --no-cache or remove the .cache directory?

@cncolder
Copy link

cncolder commented Jul 1, 2018

Example here:

package.json

{
  "dependencies": {
    "antd-mobile": "^2.2.1",
    "react": "^16.4.1"
  }
}

index.html

<html>
<body>
    <script src="./index.jsx"></script>
</body>
</html>

index.jsx

import Steps from "antd-mobile/es/steps";

parcel index.html

parcel-antd-mobile/node_modules/antd-mobile/es/steps/index.js:7:20: Cannot resolve dependency 'rmc-steps'
   5 | import _inherits from 'babel-runtime/helpers/inherits';
   6 | import React from 'react';
>  7 | import RcSteps from 'rmc-steps';
     |                     ^
   8 | import Icon from '../icon';
   9 |
  10 | var Steps = function (_React$Component) {

The rmc-steps stay there. But parcel just not seen.

ls node_modules/rmc-steps

HISTORY.md   LICENSE.md   README.md    assets       lib          package.json

This happen even after I run npm i rmc-steps --save

@DeMoorJasper DeMoorJasper changed the title Parcel can not support es6? Failed to resolve existing module rmc-steps Jul 1, 2018
@cncolder
Copy link

cncolder commented Jul 1, 2018

rmc-steps has a mistake field "module": "./es/index" in package.json. It not bundle es code into npm.

https://unpkg.com/rmc-steps@1.0.0/package.json

@DeMoorJasper
Copy link
Member

Glad you found the issue.

I'll close this issue, please report this to https://github.com/react-component/m-steps

@cncolder
Copy link

cncolder commented Jul 1, 2018

Hi @DeMoorJasper , Is there a plan to handle it like this? If module not exist then downgrade to main? I'm not sure how many packages with this mistake in npm.

@DeMoorJasper
Copy link
Member

I think this PR implements something similar: #1577

@ranfdev
Copy link
Contributor

ranfdev commented Jul 1, 2018

Yes, in that pr, parcel tries to load different files (like module, main, source) until it finds an existing one. That should solve the issue

@ranfdev
Copy link
Contributor

ranfdev commented Jul 1, 2018

@cncolder I can confirm, in #1577 your example works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants