forked from redwoodjs/redwood
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make Vite the default bundler (redwoodjs#8301)
Co-authored-by: Dominic Saadi <[email protected]> Co-authored-by: Josh GM Walker <[email protected]>
- Loading branch information
1 parent
79d9cb3
commit 6585d4d
Showing
40 changed files
with
365 additions
and
397 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
File renamed without changes.
File renamed without changes.
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { hydrateRoot, createRoot } from 'react-dom/client' | ||
|
||
import App from './App' | ||
/** | ||
* When `#redwood-app` isn't empty then it's very likely that you're using | ||
* prerendering. So React attaches event listeners to the existing markup | ||
* rather than replacing it. | ||
* https://reactjs.org/docs/react-dom-client.html#hydrateroot | ||
*/ | ||
const redwoodAppElement = document.getElementById('redwood-app') | ||
|
||
if (redwoodAppElement.children?.length > 0) { | ||
hydrateRoot(redwoodAppElement, <App />) | ||
} else { | ||
const root = createRoot(redwoodAppElement) | ||
root.render(<App />) | ||
} |
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,15 @@ | ||
import dns from 'dns' | ||
|
||
import { defineConfig, UserConfig } from 'vite' | ||
|
||
// See: https://vitejs.dev/config/server-options.html#server-host | ||
// So that Vite will load on local instead of 127.0.0.1 | ||
dns.setDefaultResultOrder('verbatim') | ||
|
||
import redwood from '@redwoodjs/vite' | ||
|
||
const viteConfig: UserConfig = { | ||
plugins: [redwood()], | ||
} | ||
|
||
export default defineConfig(viteConfig) |
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
17 changes: 17 additions & 0 deletions
17
packages/create-redwood-app/templates/js/web/src/entry-client.jsx
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,17 @@ | ||
import { hydrateRoot, createRoot } from 'react-dom/client' | ||
|
||
import App from './App' | ||
/** | ||
* When `#redwood-app` isn't empty then it's very likely that you're using | ||
* prerendering. So React attaches event listeners to the existing markup | ||
* rather than replacing it. | ||
* https://reactjs.org/docs/react-dom-client.html#hydrateroot | ||
*/ | ||
const redwoodAppElement = document.getElementById('redwood-app') | ||
|
||
if (redwoodAppElement.children?.length > 0) { | ||
hydrateRoot(redwoodAppElement, <App />) | ||
} else { | ||
const root = createRoot(redwoodAppElement) | ||
root.render(<App />) | ||
} |
19 changes: 19 additions & 0 deletions
19
packages/create-redwood-app/templates/js/web/vite.config.js
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,19 @@ | ||
import dns from 'dns' | ||
|
||
import { defineConfig } from 'vite' | ||
|
||
// See: https://vitejs.dev/config/server-options.html#server-host | ||
// So that Vite will load on local instead of 127.0.0.1 | ||
dns.setDefaultResultOrder('verbatim') | ||
|
||
import redwood from '@redwoodjs/vite' | ||
|
||
/** | ||
* https://vitejs.dev/config/ | ||
* @type {import('vite').UserConfig} | ||
*/ | ||
const viteConfig = { | ||
plugins: [redwood()], | ||
} | ||
|
||
export default defineConfig(viteConfig) |
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
17 changes: 17 additions & 0 deletions
17
packages/create-redwood-app/templates/ts/web/src/entry-client.tsx
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,17 @@ | ||
import { hydrateRoot, createRoot } from 'react-dom/client' | ||
|
||
import App from './App' | ||
/** | ||
* When `#redwood-app` isn't empty then it's very likely that you're using | ||
* prerendering. So React attaches event listeners to the existing markup | ||
* rather than replacing it. | ||
* https://reactjs.org/docs/react-dom-client.html#hydrateroot | ||
*/ | ||
const redwoodAppElement = document.getElementById('redwood-app') | ||
|
||
if (redwoodAppElement.children?.length > 0) { | ||
hydrateRoot(redwoodAppElement, <App />) | ||
} else { | ||
const root = createRoot(redwoodAppElement) | ||
root.render(<App />) | ||
} |
15 changes: 15 additions & 0 deletions
15
packages/create-redwood-app/templates/ts/web/vite.config.ts
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,15 @@ | ||
import dns from 'dns' | ||
|
||
import { defineConfig, UserConfig } from 'vite' | ||
|
||
// See: https://vitejs.dev/config/server-options.html#server-host | ||
// So that Vite will load on local instead of 127.0.0.1 | ||
dns.setDefaultResultOrder('verbatim') | ||
|
||
import redwood from '@redwoodjs/vite' | ||
|
||
const viteConfig: UserConfig = { | ||
plugins: [redwood()], | ||
} | ||
|
||
export default defineConfig(viteConfig) |
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 |
---|---|---|
|
@@ -20,6 +20,7 @@ const defaultOptions = { | |
'.jpeg', | ||
'.png', | ||
'.gif', | ||
'.svg', | ||
'.eot', | ||
'.otf', | ||
'.webp', | ||
|
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
Oops, something went wrong.