-
-
Notifications
You must be signed in to change notification settings - Fork 865
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
Override paths.js values in razzle.config.js #714
Comments
Hola! So here's the deal, between open source and my day job and life and what not, I have a lot to manage, so I use a GitHub bot to automate a few things here and there. This particular GitHub bot is going to mark this as stale because it has not had recent activity for a while. It will be closed if no further activity occurs in a few days. Do not take this personally--seriously--this is a completely automated action. If this is a mistake, just make a comment, DM me, send a carrier pidgeon, or a smoke signal. |
Well. I moved my server to new server folder inside src
It works fine but seems like after this debugging (--inspect) nodejs is broken |
Hola! So here's the deal, between open source and my day job and life and what not, I have a lot to manage, so I use a GitHub bot to automate a few things here and there. This particular GitHub bot is going to mark this as stale because it has not had recent activity for a while. It will be closed if no further activity occurs in a few days. Do not take this personally--seriously--this is a completely automated action. If this is a mistake, just make a comment, DM me, send a carrier pidgeon, or a smoke signal. |
ProBot automatically closed this due to inactivity. Holler if this is a mistake, and we'll re-open it. |
This issue shouldn't have been closed. |
I'm also using workarounds to set different application directory, it's a pretty large project that hosts API code in the same root directory, and 'src' is really ambiguous. |
@nvma Can you please provide an example to set different application directory? Thanks! |
I think this is a pretty important issue. I'd be willing to submit a PR ASAP if we can come up with a list of the core directories that should be configurable. Off the bat, I'd say: |
I was able to resolve it in my razzle / webpack configuration. |
On my radar, have sort of a plan 😀 |
In case it's useful to someone else I recently had to do this in const defaultOptions = {
server: null,
client: null,
};
function modifyEntryPoints(baseConfig, env, webpack, userOptions = {}) {
const options = { ...defaultOptions, ...userOptions };
const webpackConfig = { ...baseConfig };
const { client, server } = options;
/* This is required to rename the entry points instead of using the defaults */
if (env.target === "node" && server) {
webpackConfig.entry = [server];
}
if (env.target !== "node" && client) {
webpackConfig.entry.client = client;
}
return webpackConfig;
}
module.exports = {
plugins: [
{
func: modifyEntryPoints,
options: {
server: path.join(__dirname, "./src/docker-server"),
client: path.join(__dirname, "./src/docker-client"),
},
},
]
}; |
fixed in dev |
I would like to move my server dir into the root so my filesystem would look like this.
-/src
-server
-...etc.
Digging in razzle, it seems that babel and webpack are getting location of code from
The only issue is, because the values are hard coded, I can't override them.
I've come up with a work around by copypasting the resolveApp function from razzle to razle.config.js
and looping through rules and depending on environment and configuration I replace the include property with my custom path, like so...
This feels really hacky though. Would it be possible to abstract the hard coded values in paths.js to environment variables or expose them in the createConfig function so that I can change the paths whenever I want?
I'd be happy to work on this if it seems like a good idea, but maybe there's a solution for this already that I'm missing. Please help :)
The text was updated successfully, but these errors were encountered: