Webpack alias workaround stops working on dev and build after build run #794
Replies: 2 comments 5 replies
-
|
Hey @old-zoomer — we try and keep our issues strictly limited to bugs, but here, this is just a problem with your configuration. I'm going to move this to a discussion. But, we do understand that this aliasing is not ideal, and we have longer-term plans to fix it similarly to how NextJS eliminates server-side code, but this is quite complex. It's nearing the top of our list of priorities. In the interim, I am 100% confident that there is just a small issue somewhere. Question What are the errors that you are seeing? Potential Fix 1 Ensure that your mock files are also present and copied over to your Potential Fix 2 This is more of a best practice than anything, but if you are mocking a module for webpack, the mock should represent the same shape of data that the actual file contains. So, your mock is an empty object, but your actual file is a function. I don't think this is an issue, but it could be. Potential Fix 3 Try and delete your Give those a shot! We'll get it sorted and thanks for hanging in there. A more permanent solution is on the way. |
Beta Was this translation helpful? Give feedback.
-
|
I'll try the fixes. Regarding Fix 2 - I don't think that's the problem, because everything is working fine until I do a build Here is the error I see |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Bug Report
Webpack alias workaround stops working on dev and build after build run. I think I am going crazy here 🤡 #678 #766
Expected Behavior
if
yarn devandyarn buildworks with no errorsthen
cd distPAYLOAD_SECRET=secret MONGODB_URI=mongo node server.js^Ccd ..yarn devworks with no errors
Current Behavior
yarn devandyarn buildworks with no errorscd distPAYLOAD_SECRET=secret MONGODB_URI=mongo node server.jswebpack errorcd ..yarn devwebpack error, WTF 🤡rm -rf dist buildyarn devwebpack error, WTF 🤡🤡🤡Possible Solution
In general this webpack alias workaround is driving me crazy and i spent more of time trying to get it work then actually configuring cms, this looks like v0.1 solution, not v1.0.
Please help me get this this running with some workaround for now.
Ideal solution would be to handle this in a more mature way (not sure if this possible or makes sense considering current setup)
Steps to Reproduce
Add files
src/server-side/storage.tssrc/mocks/empty.tssrc/collections/Media.tsEdit file
src/payload.config.tsyarn dev- successyarn build- successcd distPAYLOAD_SECRET=secret MONGODB_URI=mongo node server.jswebpack compiled with 45 errors and 1 warningcd ..yarn devwebpack compiled with 45 errors and 1 warningrm -rf dist buildyarn devwebpack compiled with 45 errors and 1 warningBeta Was this translation helpful? Give feedback.
All reactions