naviapps / create-nw-react-app

Create NW.js React apps with no build configuration.
MIT License
144 stars 14 forks source link

How to open new window on production build? #26

Open 4EPHblN opened 5 years ago

4EPHblN commented 5 years ago

Hi all!! I need to open a new window to preview the document before print it.

I using the Router to separate requests by its paths:

    <Router>
        <Suspense fallback={''}>
            <Switch>
                <Print path="/print/:thingId" />
                < . . . >
                <App default />
            </Switch>
        </Suspense>
    </Router>

I try to open a new window through nw.Window.open() and <Link /> component from react-router-dom module.

When i use next code on DEVELOPMENT build thats works as was expected: window are opens and loads the content.

nw.Window.open(nw.Window.get().window.location.origin + '/print/123');
<Link to={'/print/123'} target="_blank">Print this!!</Link>

But on PRODUCTION build this shows 404 Not Found page.

How i can open a new window on PRODUCTION build??