I have a React app I\'ve been developing on my localhost. I want to copy it to a server into a subdirectory called vensa.
My webpack config file looks like this..
Or you could use an environment variable to adjust all your links manually.
const ENV = process.env.NODE_ENV || 'local'; //development
const config = {
publicPath: ENV !== 'production' ? '/' : '/dev/'
};
plugins: ([
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify(ENV),
'process.env.config': JSON.stringify(config)
})
})
Then one of your routes:
Then your links:
Account
This worked great for me. Especially since I'm using preact, whose preact-router doesn't really support the basename at this time.