It's 2024. You should use tsup instead of this.
🔥 Blazing fast builds
😇 CommonJS bundle
🌲 .mjs
bundle
✨ .d.ts
bundle + type-checking
FROM node: 14-alpine as build | |
ENV NEXT_TELEMETRY_DISABLED=1 | |
RUN apk add --no-cache libc6-compat | |
WORKDIR /app | |
COPY .. | |
RUN yarn install && \ | |
yarn build | |
FROM node: 14-alpine |
It's 2024. You should use tsup instead of this.
🔥 Blazing fast builds
😇 CommonJS bundle
🌲 .mjs
bundle
✨ .d.ts
bundle + type-checking
import SwiftUI | |
import PlaygroundSupport | |
// NOTE: this example currently only works with US-based coordinates | |
// constants | |
// New York | |
let latitude = 40.709335 | |
let longitude = -73.956558 |
Ventura docs for M2 Macs in this comment: https://gist.github.com/henrik242/65d26a7deca30bdb9828e183809690bd?permalink_comment_id=4555340#gistcomment-4555340
Old Monterey docs in this old revision: https://gist.github.com/henrik242/65d26a7deca30bdb9828e183809690bd/32c410e3a1de73539c76fa13ea5486569c4e0c5d
Solution for Sonoma: https://gist.github.com/sghiassy/a3927405cf4ffe81242f4ecb01c382ac
This is a quick-and-dirty walkthrough to set up a fresh project with Storybook Docs, Create React App, and TypeScript. If you're looking for a tutorial, please see Design Systems for Developers, which goes into much more depth but does not use Typescript.
The purpose of this walkthrough is a streamlined Typescript / Docs setup that works out of the box, since there are countless permutations and variables which can influence docs features, such as source code display, docgen, and props tables.
npx create-react-app cra-ts --template typescript
/** Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. */ | |
"use strict"; | |
/** | |
* The runtime has a single beforeExit function which is stored in the global | |
* object with a symbol key. | |
* The symbol is not exported. | |
* The process.beforeExit listener is setup in index.js along with all other | |
* top-level process event listeners. | |
*/ |
If you use
create-react-app
, #5136 (released with the 2.0) implements a--use-pnp
option that allows you to easily create a new project using PnP! In this case, just usecreate-react-app --use-pnp
together with Yarn 1.12, and you're good to go! 👍
Plug'n'Play is a new initiative from Yarn that aims to remove the need for node_modules
. It's already available, and has proved being effective even on large-scale infrastructures. This document describes in a few steps how to quickly get started with it. Spoiler alert: it's quite easy 🙂
First, download a package manager that supports it. Yarn 1.12 already does, so that's what we're going to use! To install it, just follow the instructions on our website: https://yarnpkg.com/en/docs/install
If everything is ok, running
yarn --version
should give youv1.12.1
or higher. If you don't get this result maybe a
/* | |
html-webpack-plugin-lite | |
Usage: | |
new HtmlWebpackPluginLite({ | |
title: "Webpack demo", // Available in context | |
template: ({ css, js, title }) => ... html ... | |
}), | |
*/ |
import React from 'react'; | |
import debounce from 'utils/debounce'; | |
class EmailInput extends React.Component { | |
checkEmail = value => { | |
// only check if the field passes Yup email validation first | |
if ( | |
!this.props.form.errors[this.props.name].includes( | |
'invalid' /* or whatever your error message is*/ | |
) |
if (typeof window!=='undefined' && navigator.serviceWorker && navigator.serviceWorker.controller) { | |
let reloadOnNext = false; | |
let pushState = history.pushState; | |
history.pushState = function(state, title, url) { | |
pushState.call(this, state, title, url); | |
if (reloadOnNext===true) location.reload(true); | |
}; | |
navigator.serviceWorker.controller.addEventListener('statechange', e => { |