Closed danielr18 closed 4 years ago
Env vars are never booleans. You do Boolean(process.env.MY_BOOL || 'false'): MY_BOOL='' => Boolean('' || 'false') => Boolean('false') MY_BOOL=null => Boolean('false') typeof MY_BOOL === 'undefined' => Boolean('false') MY_BOOL='false' => Boolean('false') MY_BOOL='true' => Boolean('true')
Env vars are never booleans. You do Boolean(process.env.MY_BOOL || 'false'):
Boolean(process.env.MY_BOOL || 'false')
MY_BOOL=''
Boolean('' || 'false') => Boolean('false')
MY_BOOL=null
Boolean('false')
typeof MY_BOOL === 'undefined'
MY_BOOL='false'
MY_BOOL='true'
Boolean('true')
The thing is that process.env.__NEXT_EXPORT_TRAILING_SLASH is replaced by webpack's DefinePlugin, the end result is something like:
process.env.__NEXT_EXPORT_TRAILING_SLASH
external_react_default.a.createElement(connected_next_router["ConnectedRouter"], { exportTrailingSlash: false }, external_react_default.a.createElement(Component, pageProps)))); }
return s.a.createElement( c.Container, null, s.a.createElement( f.a, { store: r }, s.a.createElement(O.a, { exportTrailingSlash: !1 }, s.a.createElement(e, n)) ) )
So it's actually not going to be a string in the built code, that's why I didn't convert it to a boolean. Thoughts?
Nice work!
The thing is that
process.env.__NEXT_EXPORT_TRAILING_SLASH
is replaced by webpack's DefinePlugin, the end result is something like:So it's actually not going to be a string in the built code, that's why I didn't convert it to a boolean. Thoughts?