-
-
Notifications
You must be signed in to change notification settings - Fork 375
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: Closer but still a bunch of issues
1 parent
a8e740a
commit 2c2d2e3
Showing
22 changed files
with
113 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,21 @@ | ||
import { Component } from 'preact'; | ||
import { Router } from 'preact-router'; | ||
import Home from './routes/home'; | ||
import Route66 from './routes/route66'; | ||
import Route89 from './routes/route89'; | ||
import './style.css'; | ||
import { LocationProvider, Router } from 'preact-iso/router'; | ||
import { default as lazy, ErrorBoundary } from 'preact-iso/lazy'; | ||
|
||
export default class App extends Component { | ||
handleRoute = e => { | ||
this.currentUrl = e.url; | ||
}; | ||
const Home = lazy(() => import('./routes/home.js')); | ||
const Route66 = lazy(() => import('./routes/route66.js')); | ||
const Route89 = lazy(() => import('./routes/route89.js')); | ||
import './style.css'; | ||
|
||
render(props) { | ||
return ( | ||
<div id="app"> | ||
<Router url={props.url} onChange={this.handleRoute}> | ||
export default function App() { | ||
return ( | ||
<LocationProvider> | ||
<ErrorBoundary> | ||
<Router> | ||
<Home path="/" /> | ||
<Route66 path="/route66" /> | ||
<Route89 path="/route89" /> | ||
</Router> | ||
</div> | ||
); | ||
} | ||
</ErrorBoundary> | ||
</LocationProvider> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
module.exports = function (config, env, helpers) { | ||
// TODO: clean up later, just removes the async loader | ||
if (env.isProd && !env.isServer) { | ||
config.module.rules.pop(); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { LocationProvider, Router } from 'preact-iso/router'; | ||
import { default as lazy, ErrorBoundary } from 'preact-iso/lazy'; | ||
|
||
const Home = lazy(() => import('./routes/home.js')); | ||
const Route66 = lazy(() => import('./routes/route66.js')); | ||
const Route89 = lazy(() => import('./routes/route89.js')); | ||
import './style.css'; | ||
|
||
export default function App() { | ||
return ( | ||
<LocationProvider> | ||
<ErrorBoundary> | ||
<Router> | ||
<Home path="/" /> | ||
<Route66 path="/route66" /> | ||
<Route89 path="/route89" /> | ||
</Router> | ||
</ErrorBoundary> | ||
</LocationProvider> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"private": true, | ||
"name": "preact-preload-chunks" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
module.exports = function (config, env, helpers) { | ||
// TODO: clean up later, just removes the async loader | ||
if (env.isProd && !env.isServer) { | ||
config.module.rules.pop(); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.home { | ||
background: red; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { useBase } from '../useBase'; | ||
import './home.css'; | ||
|
||
export default () => { | ||
const base = useBase(); | ||
|
||
return <div>{base}Home</div>; | ||
}; |
3 changes: 3 additions & 0 deletions
3
packages/cli/tests/subjects/preload-modern/routes/route66.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.route66 { | ||
background: tomato; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { useBase } from '../useBase'; | ||
import './route66.css'; | ||
|
||
export default () => { | ||
const base = useBase(); | ||
|
||
return <div>{base}route66</div>; | ||
}; |
3 changes: 3 additions & 0 deletions
3
packages/cli/tests/subjects/preload-modern/routes/route89.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.route66 { | ||
background: tomato; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { useBase } from '../useBase'; | ||
import './route89.css'; | ||
|
||
export default () => { | ||
const base = useBase(); | ||
|
||
return <div>{base}route89</div>; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
html { | ||
padding: 0px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { useState } from 'preact/hooks'; | ||
|
||
export function useBase() { | ||
const [dummyState, _setDummyState] = useState(''); | ||
return dummyState; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters