-
-
Notifications
You must be signed in to change notification settings - Fork 23
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
Re-import axios ! #34
Conversation
Merge georgeboot main
If the caller project doesn't have it as a dependecy, it won't work !
@Adesin-fr Okay I've merged it ... yes in the git history I see that on November 11th you added the Axios import, and then on November 15th I removed it, lol ... why did you add it in the first place (on the 11th) ? Because originally it wasn't there ... but I also don't remember why I removed it again - I hope that adding it back isn't going to cause issues ;-) Anyway, I'm going to test and debug this (I'll probably add more logging in a few places, also in the PHP code) ... Just a silly question: In order to test/debug this I'm increasing the version number, make a release, deploy it to npmjs, then build and deploy our app to AWS, etc - and only then can I start testing/debugging it - and if it doesn't work and I need to make changes, then I need to go through this whole long-winded process again - isn't there a way to simplify this and to speed this up? Maybe just point to a "local" version in my package.json and/or composer.json, I've done something like that before - that still leaves the lengthy AWS deploy from our app, but at least we don't need to go through a full "publish" ... tips, ideas, thoughts? P.S. ah, look what I have now - one of the Github CI jobs (ESLint) is now failing - for sure that's the reason why I removed the Axios import, because I'm now getting a mountain of errors, see screenshot below See details here: https://github.com/georgeboot/laravel-echo-api-gateway/actions/runs/12067411745/job/33650302647 This is now failing ... thoughts? Can't we get rid of the import again - can't you add the dependency to your app? Previously the import was NOT there - if it's not necessary then I would prefer not to have it ... |
Yes you can reference your local npm package in your target env . |
@Adesin-fr Thanks, yes I've done something like that previously, either with npm or with composer or both - I don't remember the details of how to do it, but I'll figure it out ... But, we now have a build error, see previous comment - for sure that's the reason why I removed that Axios import (which we previously didn't have ...) |
@Adesin-fr What shall we do with this - do you think it's possible to get rid of the build error, or shall we remove the import again and you add the dependency to your app's |
That's not a good thing to depend on caller's dependencies ! |
@Adesin-fr I understand what you say, but the import wasn't there to begin with ... yes please have a look :) |
@Adesin-fr Okay, I really have my doubts if this it's wisdom to push on with this "import axios" thing, but with a lot of trial and error I MIGHT have got it working ... First, I did a local
I then looked up https://rollupjs.org/guide/en/#warning-treating-module-as-external-dependency and here's what it says: _Warning: "Treating [module] as external dependency" import moment from 'moment'; …won't result in moment being included in your bundle – instead, it will be an external dependency that is required at runtime. If you do want to include the module in your bundle, you need to tell Rollup how to find it. In most cases, this is a question of using @rollup/plugin-node-resolve._ So I then went down into a rabbit hole involving "rollup" and "rollup plugins" and so on (all of which I never heard about before), and then I came across this link: https://limistah.dev/posts/configure-axios-rollup/ So I went ahead and did what this article says, and added those "rollup plugins" and a piece of "rollup config" ... and then it still didn't work ;-) I then came across this one: so I then got rid of the other 2 "plugins" and switched to the "common JS" one - and then it STILL didn't work ... but, when I threw all 3 plugins in, and their pieces of config, THEN To me it feels I have no clue what I'm doing, and I'm just googling and doing "trial and error", but somehow this seems to at least build ... but another story is whether it will also WORK. I'll create a PR for you with the stuff I cobbled together and you can test if that works - but, right now I'm going to delete that import statement from P.S. what also irks me enormously is the hassle with
No idea what this is, and only "yarn" complains about it ... I'm also getting this on a frequent basis:
Solution is to delete the Not to mention the fact that we now have |
@Adesin-fr I've deleted the I see that it triggers a bunch of failed Github CI jobs, so I think this needs extra work (but I'm mainly blaming "yarn" for that), but I'm now going to focus on getting the functionality of PR 33 working with our app, I'll leave PR 35 to you ... |
I have something that seems to compile and work with axios. |
Axios import can't be removed !
If the main project doesn't include project (which can happen, I do !!), then this will fail without axios...