This worker script will evaluate your origin response, and replace html comments marked as fragment:key with a respective prefetch defined in a X-Fragments response header.
Your origin must include the X-Fragments header, specifying the a comma separated list of prefetch requests to make for that response.
< HTTP/1.1 200 OK
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
| module.exports = { | |
| entry: { | |
| main: path.resolve(__dirname, 'src/index.js'), | |
| ProductList: path.resolve(__dirname, 'src/ProductList/ProductList.js'), | |
| ProductPage: path.resolve(__dirname, 'src/ProductPage/ProductPage.js'), | |
| Icon: path.resolve(__dirname, 'src/Icon/Icon.js'), | |
| }, | |
| output: { | |
| path: path.resolve(__dirname, 'dist'), |
This is tutorial of onfiguring eslint, prettier for your project
Make your code great again
- Eslint
First of all we need to install eslint and configs as dev dependencies. You can use your own config, but I will use config from airbnb:
yarn add -D eslint eslint-config-airbnb eslint-plugin-import eslint-plugin-jsx-a11y eslint-plugin-react
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
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <title>Caesar Cipher</title> | |
| <style type="text/css"> | |
| body { | |
| margin: 0 auto; | |
| max-width: 40em; | |
| width: 88%; |
The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.
This means you have the following choices:
- Use ESM yourself. (preferred)
Useimport foo from 'foo'instead ofconst foo = require('foo')to import the package. You also need to put"type": "module"in your package.json and more. Follow the below guide. - If the package is used in an async context, you could use
await import(…)from CommonJS instead ofrequire(…). - Stay on the existing version of the package until you can move to ESM.
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
| // usage examples | |
| // callback | |
| const err1 = await waitError(() => { /* do something that throws */ }) | |
| // async callback | |
| const err2 = await waitError(async () => { /* do something async that throws */ }) | |
| // expect a promise instance to throw | |
| const err3 = await waitError(promise) |
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 { | |
| queryByLabelText, | |
| queryByRole, | |
| queryByText, | |
| } from "@testing-library/dom"; | |
| import type { ByRoleOptions, Matcher } from "@testing-library/dom"; | |
| const roles = [ | |
| "alert", | |
| "alertdialog", |