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

Expose resolveApp for plugins #1209

Closed
fivethreeo opened this issue Mar 13, 2020 · 14 comments
Closed

Expose resolveApp for plugins #1209

fivethreeo opened this issue Mar 13, 2020 · 14 comments

Comments

@fivethreeo
Copy link
Collaborator

https://github.com/jaredpalmer/razzle/blob/master/packages/razzle/config/paths.js#L10

@nimaa77
Copy link
Collaborator

nimaa77 commented Mar 16, 2020

we have to create 2 APIs so with that

  1. users easily change the paths
  2. they access paths inside razzle.config.js and other razzle plugins

@fivethreeo
Copy link
Collaborator Author

Don't quite get what you mean. I just meant export resolveApp. But what is your idea? 😀

@nimaa77
Copy link
Collaborator

nimaa77 commented Mar 17, 2020

I saw in multiple issues people want to access some paths in razzle.config.js, there is a pull request for it too

so I'm thinking about a way to give users all the path variables are available in paths.js file

@fivethreeo
Copy link
Collaborator Author

So like a paths argument in a plugin or razzle.config.js? Pull #?

@fivethreeo
Copy link
Collaborator Author

Do you mean #457?

@nimaa77
Copy link
Collaborator

nimaa77 commented Apr 7, 2020

no, not that one/
look at this #714

@nimaa77
Copy link
Collaborator

nimaa77 commented Apr 8, 2020

@fivethreeo hey, I want to ask @jaredpalmer to tag a new minor relase for Razzle.
I saw you had some cool open pull requests, merge those to next branch and then ping me.

thanks

@fivethreeo
Copy link
Collaborator Author

Jared tried something like #714 in #457 and there one pr open in #940. I agree on giving access to paths in the plugins/modify but changing them might be a bit easy to cause conflicts if done in plugins and add extra complexity even if just added to razzle.config.js. If you need custom paths derive them from resolveApp. If builtin options except in start or build scripts needs overriding just replace loaders/plugins with the new options since it is more specific and you know what they will affect. If anything we could add some kind of context where modify/plugins can share options if need be.

@nimaa77
Copy link
Collaborator

nimaa77 commented Apr 8, 2020

umm

@nimaa77
Copy link
Collaborator

nimaa77 commented Apr 9, 2020

but it's cool to have it

@fivethreeo
Copy link
Collaborator Author

But can be a bit confusing if multiple plugins change paths. So maybe just in razzle.config.js? I see multiple modules importing './paths' so we need to pass those around somehow leading to making some parts calls/callbacks instead of imports.

@nimaa77
Copy link
Collaborator

nimaa77 commented Apr 9, 2020

Another question
do we need to add sideEffects: false to babel-loader in webpack loaders config or it's unnecessary

@fivethreeo
Copy link
Collaborator Author

I think terser takes care of that. But not quite sure.

@fivethreeo
Copy link
Collaborator Author

Been thinking some more about this, there are many options except just regular paths people want to change. What if we change createConfig to first make the options to the various parts of the webpack configuration. Then pass that to modifyOptions in plugins and razzle.config.js to be modified before creating the webpack config. But I also see a need for modifyPaths (even in plugins) aswell. Should it be a way to set where razzle should look for razzle.config.js in monorepos, e.g. a env var?

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

2 participants