ethanent / phin

Node HTTP client
MIT License
576 stars 33 forks source link

phin centra Cannot find module "." #34

Closed Rtfsc-8 closed 5 years ago

Rtfsc-8 commented 5 years ago

In my project used phin, when I view my page the browse's console display error log like this: Uncaught Error: Cannot find module "." at createRequest.js:3 at Object.+1SP (createRequest.js:3) at t (bootstrap 0aea77b2c74adfcd1d30:54) at Object.jBJh (phin.min.js:6) at t (bootstrap 0aea77b2c74adfcd1d30:54) at Object.QBjc (example.svg:10) at t (bootstrap 0aea77b2c74adfcd1d30:54) at Object./AcQ (language.svg:10) at t (bootstrap 0aea77b2c74adfcd1d30:54) at Object.2NXm (UcarHeadline.vue:27)

Here are building logs: $ npm run build test Hash: 0aea77b2c74adfcd1d30 Version: webpack 3.12.0 Time: 31284ms

WARNING in ./node_modules/centra/createRequest.js 3:22-80 Critical dependency: the request of a dependency is an expression @ ./node_modules/centra/createRequest.js @ ./node_modules/phin/lib/phin.min.js @ ./src/service/apinew.js @ ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/selector.js?type=script&index=0!./src/pages/index.vue @ ./src/pages/index.vue @ ./src/router/index.js @ ./src/main.js

Here are version info: $ npm ls centra -- phin@3.3.0 -- centra@2.2.2

Thks

hubjun commented 5 years ago

install phin import phin from 'phin' npm run dev ... 3:22-80 Critical dependency: the request of a dependency is an expression

ethanent commented 5 years ago

Thanks for sharing about this issue. I think it'd be helpful if you were to provide some more information about the context in which you are using the phin library as some of your logs look unusual to me.

Edit:

Thanks for sharing. This makes it seem like ethanent/centra is not webpack compatible. This is likely because centra refers to its contained modules using require(path.join(...)). To resolve this problem, it would be necessary to update these references within centra.

This should go on the to-do list.

bdsomer commented 5 years ago

I don't think phin has browser support, if you're trying to use it for that, @Rtfsc-8.

ethanent commented 5 years ago

@bdsomer

ethanent commented 5 years ago

@bdsomer

ethanent commented 5 years ago

Ah, and yes, that's the issue. phin doesn't yet support browsers. An upstream PR to centra may be able to fix this issue: https://github.com/ethanent/centra/pull/2

ethanent commented 5 years ago

Ok, this has been resolved now thanks to centra@2.3.0, which is in-range for phin installations! https://github.com/ethanent/centra/commit/7b810e5cb39cbc0dcf93cf712287529bdeb10a0f

Thanks for your suggestion, @Rtfsc-8 and @hubjun.