This file contains hidden or 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
import { RemixBrowser } from "@remix-run/react"; | |
import { startTransition, StrictMode } from "react"; | |
import { hydrateRoot } from "react-dom/client"; | |
function hydrate() { | |
startTransition(() => { | |
hydrateRoot( | |
// 👋 Hydrate into the proper element, not the document! | |
document.querySelector("#app"), | |
<StrictMode> |
This file contains hidden or 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
#!/usr/bin/env node | |
// Usage: | |
// node update-remix.js [version] | |
const { join } = require("path"); | |
const { execSync } = require("child_process"); | |
const [, , version] = process.argv; | |
if (!version) { |
This file contains hidden or 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
// Assume you want to do this in your routes, which are in the critical path JS bundle | |
<Route path="lazy" loader={lazyLoader} element={<Lazy />} /> | |
// And assume you have two files containing your actual load and component: | |
// lazy-loader.ts -> exports the loader | |
// lazy-component.ts -> exports the component | |
// We'll render the component via React.lazy() | |
let LazyActual = React.lazy(() => import("./lazy-component")); |
This file contains hidden or 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
const logLevel = process.env.LOG_LEVEL; | |
const noop = () => {}; | |
export default { | |
debug: | |
logLevel === 'debug' ? | |
console.debug.bind(console) : | |
noop, | |
info: |
This file contains hidden or 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
const Vue = require('vue') | |
const renderer = require('vue-server-renderer').createRenderer() | |
// Class attributes with newlines in the for formatting end up rendering | |
// trailing `\n` characters which causes the classname not to apply. | |
// I.e., `long-classname-2 long-classname-3\n long-classname-4` | |
// So .long-classname-3 styles to not apply | |
const app = new Vue({ | |
template: | |
`<div> |
This file contains hidden or 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
const Vue = require('vue') | |
const renderer = require('vue-server-renderer').createRenderer() | |
// Would expect this to render the v-show="true" div without any style attribute | |
// Instead, it renders with style="display:;" | |
const app = new Vue({ | |
template: '<div>\n' + | |
' <p>v-show=true</p>\n' + | |
' <p v-show="true">v-show=true</p>\n' + | |
' <p v-show="false">v-show=false</p>' + |
This file contains hidden or 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
~/working> mkdir hapi-npmv4-issue | |
~/working> cd hapi-npmv4-issue/ | |
~/working/hapi-npmv4-issue> npm init | |
This utility will walk you through creating a package.json file. | |
It only covers the most common items, and tries to guess sensible defaults. |