Hi!
I would like to achieve something similar to what React Native does with the .android.js and .ios.js extensions. The idea is to have 2 different "extensions" and "decide" which one to use base on an env var.
I've made a quick test using create-react-app and I achieved it by using this webpack config:
resolve: {
extensions: [`.${process.env.VAR}.js`, '.js'],
...
}
Lets say that process.env.VAR is foo, if I import Component, webpack will first try to find Component.foo.js and if doesn't exist will search for Component.js.
Is there a way to do something similar in Next? Reading a few issues I've found a pagesExtensions existing in next.config.js but I'm not sure if work similar to webpack's extensions config…
Hi!
I would like to achieve something similar to what React Native does with the
.android.jsand.ios.jsextensions. The idea is to have 2 different "extensions" and "decide" which one to use base on an env var.I've made a quick test using
create-react-appand I achieved it by using this webpack config:Lets say that
process.env.VARisfoo, if I importComponent, webpack will first try to findComponent.foo.jsand if doesn't exist will search forComponent.js.Is there a way to do something similar in Next? Reading a few issues I've found a
pagesExtensionsexisting innext.config.jsbut I'm not sure if work similar to webpack'sextensionsconfig…