last day (15 days later) » 

08:59
0
Q: Change entry point of reactjs application

KOTIOSI am deploying an application of react and i want to understand that when i deploy react application(lets say at domain.com) it works on domain.com and it takes index.html as default html to mount the react application components. My question is i want a url on my host lets say domain.com/app/s...

Are you using webpack?
yes i m using webpack
Alright, can you show the code of your config?
@Chris please find the edited question
You config has index.html, have you tried changing this to startup.html?
08:59
i tried adding that but then there is error in that case i also tried /app/startup.html
What error do you get? Does that file exist physically?
let me show you that case , yes the file also exist
@Chris i edited the webpack like below :
config.plugins.push(new HtmlWebpackPlugin({
template: inProjectSrc('index.html'),
inject: true,
minify: {
collapseWhitespace: true,
},
}));

config.plugins.push(new HtmlWebpackPlugin({
inject: true,
chunks: ["admin"],
template: inProjectSrc('index.html'),
filename: 'admin.html',

}));
okay, but what error do you get when you change that to startup.html?
sometimes console error says no route found for admin
Did you try changing template: inProjectSrc('index.html'), to template: inProjectSrc('startup.html'),
?
09:03
one moment
tried changing like this but still not rendered on admin.html
my application has admin.html physically also
09:19
@Chris any idea?
I dont know where admin.html came in. Your question was how to make your app run on startup.html rather than index.html
yes admin.html is just example i can change that to startup.html also
basically my question is how to boot application on other path rather than index.html
@Chris
Well it looks like your app is running
you are getting errors from your bundle
In other words, you have changed the root path but you are now getting other errors from react-router
nope there is no error from bundle
I can see it from your screenshot
react-router throws an error
09:23
bundle.js is working properly on index.html
yes that what my question say why not other path can load it
That probably depends on how your react-router configuration looks like
can u tell me when i load application as
localhost:2000 the react application boot up but

when i use locahost:2000/index.html it does not why?
your react app loads fine from admin.html but react-router cant find a route for it
i dont think so chris react is single page application and index.html is used only for mouning the code on root fiv
div*
09:26
Can u please tell me this :


can u tell me when i load application as
localhost:2000 the react application boot up but

when i use locahost:2000/index.html it does not why?
on the right in red
bundle.js
the problem is not webpack
i mentioned the /admin is not valid path hence it was typo on broswer
Can u please tell me this :


can u tell me when i load application as
localhost:2000 the react application boot up but

when i use locahost:2000/index.html it does not why?
It might be a router issue. How does your router config look like?
Alternatively, you may need to configure your server to ignore anything after localhost
so that all paths under localhost redirect to root. E.g: localhost:8080/index.html -> localhost:8080
you need to google this more

last day (15 days later) »