Commit c1a984d9 authored by Dan Abramov's avatar Dan Abramov Committed by GitHub
Browse files

Document configuration and build process (#362)

parent c13f7f40
main 0.9.x 3.x add-babel-plugin-optimize-react amyrlam-patch-1 dependabot/npm_and_yarn/follow-redirects-1.14.8 dependabot/npm_and_yarn/nanoid-3.3.1 dependabot/npm_and_yarn/prismjs-1.27.0 feat/audits github-actions-ci github/fork/AMS777/patch-3 github/fork/Aghassi/patch-1 github/fork/AkiJoey/master github/fork/AlexWebLab/patch-1 github/fork/Amila-Rukshan/patch-1 github/fork/AmyShackles/patch-1 github/fork/Andarist/fix/manifest-handle-all-entrypoints github/fork/Andarist/improve-code-comments github/fork/Andarist/patch-2 github/fork/Andarist/remove-babel-core-from-preset-deps github/fork/AriPerkkio/pr/fix-slow-app-creation github/fork/AryaAnish121/patch-1 github/fork/AshmeetSingh987/master github/fork/Ayushparikh-code/patch-1 github/fork/BenBonno/main github/fork/Bluefitdev/master github/fork/Bnaya/webpack-ignore-irrelevant-warnings github/fork/BogdanDor/remove-webpackHotDevClient github/fork/BrainEno/yakai911 github/fork/CarlRibbegaardh/feature/filename github/fork/CarlRibbegaardh/feature/tsconfig-config github/fork/CharlesStover/001 github/fork/ChithurajMsys/patch-1 github/fork/CommanderRoot/refactor/rm-deprecated-substr github/fork/DanielBailey-web/patch-1 github/fork/DavidKessel/website-update github/fork/DemonHa/add-fullySpecified-cofiguration github/fork/Ekwuno/add-cloudflare-pages-to-deploy github/fork/Emanisay/emanisay27-patch-2 github/fork/ErfanMirzapour/master github/fork/FeatherBlack/master github/fork/Ferri0/patch-1 github/fork/FezVrasta/feat/profile-env-variable github/fork/FezVrasta/patch-5 github/fork/FezVrasta/patch-6 github/fork/FezVrasta/wp5-worker-url-plugin github/fork/FloydJohn/fix-browser-env github/fork/FontEndArt/main github/fork/Garciaa94/patch-1 github/fork/GiaKhai/patch-1 github/fork/HAMED-NIYAZI/patch-1 github/fork/Haosik/patch-1 github/fork/HewlettPackard/main github/fork/HollyPony/main github/fork/HugoGEORGET/fix-proxy-middleware-documentation github/fork/HumbertoL/fix/remove-extra-period github/fork/JLHwung/fix-failing-master github/fork/Jarryxin/main github/fork/Jarryxin/wp5 github/fork/JensColman/patch-1 github/fork/Jhinpan/patch-1 github/fork/Jiacheng787/main github/fork/KennethSundqvist/mocking-node-modules github/fork/Kingwl/InlineChunkHtmlPlugin_defer github/fork/KurtGokhan/lint-command github/fork/Lesliemicheal111/patch-1 github/fork/LinusU/disable-tsc-plugin github/fork/M-Usman-Tahir/patch-1 github/fork/M779-star/patch-1 github/fork/Manc/patch github/fork/ManishINN/main github/fork/MarcusMorba/patch-3 github/fork/MartijnHols/fix/12044-dont-install-tailwindcss github/fork/Methuselah96/add-missing-peer-dependencies github/fork/MichaelDeBoey/patch-1 github/fork/MichaelDeBoey/patch-2 github/fork/Mk-Etlinger/patch-2 github/fork/MozhganShafiee/main github/fork/Mrman/core-js-config-change github/fork/Nareshdhori/0.9.x github/fork/Nareshdhori/circleci-project-setup github/fork/NeoLegends/fix/create-element github/fork/NightWalker9/patch-2 github/fork/NoamGaash/patch-1 github/fork/PeteSchuster/patch-1 github/fork/Ph0enixKM/patch-1 github/fork/PranavSenthilnathan/setupProxyTs github/fork/Rahim-Chan/fix/filename github/fork/RakeshPotnuru/patch-1 github/fork/RomainTHD/main github/fork/Seokkitdo/patch-1 github/fork/SiegfriedEhret/patch-1 github/fork/Skyscanner/leop-317-sassfunction github/fork/SyedMuhammedBilal/patch-2 github/fork/SyedMuhammedBilal/patch-4 github/fork/TheAli711/main github/fork/TheLarkInn/feature/organize-config github/fork/TitusEfferian/titusefferian/docs/pre-render github/fork/TrySound/upgrade-svgr-6 github/fork/VNDRMKT/main github/fork/VoloshchenkoAl/babel-plugin-formatjs github/fork/WesCossick/fix-missing-build-error-paths github/fork/YehudaKremer/patch-1 github/fork/YuanXingH/fix/webpack-tsc-compile-on-error github/fork/ace4port/patch-1 github/fork/acusti/template-comment-typo-fix github/fork/adebiyi-al/docs/deployment github/fork/admindivyansh/patch-2 github/fork/adrielcodeco/main github/fork/aixfox/master github/fork/ajbogh/main github/fork/akolade011/dev github/fork/akuji1993/master github/fork/alexandr-g/deps/husky-v5 github/fork/alexkev/running-tests-recommended-wording github/fork/alexxyzeng/main github/fork/allanzi/patch-1 github/fork/amatissart/fix-webpack-config-glob github/fork/amcgee/feat-auto-publicpath github/fork/amehdaly/master github/fork/andrearota/master github/fork/andrzej-erli/patch-1 github/fork/ankitmadhwani24/main github/fork/annie-kat/patch-1 github/fork/antzshrek/master github/fork/anuragarwalkar/patch-1 github/fork/atefBB/patch-1 github/fork/await-ovo/fix-docs-add-typescript github/fork/await-ovo/fix-missing-postcss-plugins github/fork/aymans/patch-1 github/fork/ayush987goyal/pr/chunk-minsize github/fork/barionleg/amyrlam-patch-1 github/fork/barionleg/unpin-babel-loader github/fork/bbrk24/main github/fork/bdenhollander/patch-1 github/fork/behnammodi/total-size github/fork/benjaminr-ps/add-wds-socket-protocol github/fork/benjaminr-ps/patch-1 github/fork/bhardwajhimanshu219/svgr-webpack-version-upgrade github/fork/binary-person/patch-1 github/fork/bkrausz/patch-1 github/fork/bluenote10/bugfix/attempt_to_fix_custom_loader_race_condition github/fork/bmuenzenmeyer/master github/fork/bradjones1/patch-1 github/fork/bradoyler/patch-1 github/fork/breyed/patch-1 github/fork/british-council/fix/yarn-link-lerna github/fork/buuug7/patch-1 github/fork/c-w/remove-style-loader github/fork/camjackson/master github/fork/candrews/dropconsole github/fork/carlosparreno/v5-fix-splitchunks-issue-prod-build github/fork/caub/patch-1 github/fork/ceithir/editorconfig github/fork/chadwithuhc/patch-1 github/fork/challet/patch-launchEditor github/fork/cheesestringer/fix-package-lock-json github/fork/cheesestringer/update-measuring-performance github/fork/christopher-francisco/dart-sass github/fork/chybisov/patch-1 github/fork/cindyledev/issue-7886 github/fork/codybentson2/patch-1 github/fork/cprecioso/no-svgr-url-import github/fork/cszo/homepage-fix github/fork/cybermerlin/hotfix/jest_upgrade github/fork/daceynolan/typescript-ambiet-modules-docs github/fork/dan-valentine/Allow-Proxy-to-be-set-by-environment-variables github/fork/danconnell/react-error-overlay-nonce github/fork/danielmahon/master github/fork/danvc/all_add_multiple_entry_points_1084 github/fork/darthmaim/patch-1 github/fork/daschaa/main github/fork/daylesalmon/patch-1 github/fork/dblazheski96/entry-path-variable github/fork/ddzz/gha-update github/fork/dedo1911/main github/fork/demurgos/fix/12625-ts-node16 github/fork/demurgos/fix/7147-ts-composite github/fork/derbyshire10/main github/fork/devinrhode2/patch-1 github/fork/dilanx/patch-1 github/fork/donnygitsome/main github/fork/draculapile/fix/babel-parser-error github/fork/dtran320/patch-1 github/fork/dylan8902/patch-1 github/fork/easyandme/patch-1 github/fork/eckdanny/docs/add-skip-preflight-check-docs github/fork/elrumordelaluz/patch-1 github/fork/elrumordelaluz/patch-2 github/fork/email2vimalraj/master github/fork/entropitor/fix-no-emit github/fork/etalab/cra-envs github/fork/eventualbuddha/add-@babel/plugin-proposal-private-property-in-object-dependency github/fork/fanny/master github/fork/fivecar/cache_clear_docs github/fork/fkirc/fix_slow_recompile_times github/fork/forana/clear-console github/fork/fupengl/master github/fork/gabrieldejesus/patch-1 github/fork/gaearon/hot-reload-again github/fork/gdethier/main github/fork/geewoo94/config/tailwind github/fork/gergelypap/fix/remove-noopener github/fork/getzelus/patch-1 github/fork/giovannibenussi/loading-indicator github/fork/giovannibenussi/master github/fork/gminova/fix/remove-redundant-imports github/fork/happymonday/master github/fork/hasanayan/module-federation github/fork/herbievine/patch-1 github/fork/hermansje/feat/jsxImportSource github/fork/heygrady/preset-env-modern github/fork/hoangle4/patch-1 github/fork/huyenltnguyen/patch-1 github/fork/iamayushdas/codeblocks github/fork/iamstarkov/patch-1 github/fork/iansu/drop-node-14 github/fork/iansu/node-17-ci github/fork/iansu/worker-loader github/fork/improper/bugfix/version-check-breaks-file-path-usage github/fork/ioloie/enable-write-to-disk github/fork/ivanmcgregor/patch-1 github/fork/izzygld/patch-1 github/fork/jaime-ez/patch-1 github/fork/jakejakeho/patch-1 github/fork/jamescostian/improve-setup-proxy-extension-support github/fork/jamescostian/improve_ts_extension_support github/fork/jameswithers89/patch-1 github/fork/jamidwyer/fix/error-overlay-iframe-axe github/fork/jamirvin/main github/fork/jayeshmann/patch-1 github/fork/jean-smaug/bump-jest-in-react-scripts github/fork/jmgregory/stable-env-var-order github/fork/joeldenning/cjs-support github/fork/joelparkerhenderson/main github/fork/joey-laminar/patch-1 github/fork/johnnyreilly/patch-1 github/fork/jomarquez21/avoid-casting-on-root-element github/fork/jonatanklosko/jk-stdin-close-exit github/fork/joostlubach/joostlubach-open-browser github/fork/judycodes/patch-1 github/fork/jwalton9/main github/fork/karlhorky/patch-1 github/fork/karlhorky/patch-2 github/fork/kavinkuma6/patch-1 github/fork/kaykayehnn/fix-react-error-overlay-ts-errors github/fork/kayuapi/patch-1 github/fork/khalidwaleed0/patch-1 github/fork/kiancross/sass-loader-peer-dep github/fork/kidroca/patch-1 github/fork/kingsmendv/patch-for-pnp github/fork/kitsunekyo/feat/allow-postcss-config-override github/fork/kixxer01/patch-1 github/fork/knopp10000/patch-1 github/fork/kombucha/2378-lint-warning-most-recent-file github/fork/kopyl/patch-1 github/fork/krotovic/master github/fork/krreet/swap-babel-out-with-swc-in-start-build-and-test-2 github/fork/larixer/main github/fork/laxsuryavanshi/main github/fork/ldeninski/bugfix/add-missing-cjs-extension-to-webpack-config github/fork/levrik/editor-detection-wsl github/fork/lfshr/issue-8596/fix-win32-resolve-url-loader github/fork/limal/patch-1 github/fork/llshicc/master github/fork/louy2/patch-1 github/fork/luanorlandi/docs/react-scripts-dependency github/fork/lucabattistini/feat/webpack-svgr-loader github/fork/lucasff/patch-1 github/fork/ludofischer/reduce-noise github/fork/luffy84217/fix-webpack-dev-server-deprecated-option github/fork/luwuer/logo-cannot-be-selected github/fork/luxp/master github/fork/macjabeth/jonathan-picazo github/fork/maksimdegtyarev/remove-react-import github/fork/manavm1990/main github/fork/maoqxxmm/fix/typo github/fork/marcofugaro/cache-directory-jest github/fork/marvelsrp/hotfix-lint-treads github/fork/mcfedr/cjs-support github/fork/mdevils/update-html-entities-with-flow-types github/fork/merceyz/merceyz/fix/missing-dependencies github/fork/milesibastos/patch-1 github/fork/mkarajohn/fix-absolute-paths-in-jest-config-modulePaths github/fork/mmazzarolo/patch-1 github/fork/modernizer-bot/explicit-path-5 github/fork/mohd-akram/add-eslint-context-rule github/fork/morellodev/patch-1 github/fork/mrduguo/main github/fork/mrmckeb/feature/verify-git-package-names github/fork/msaaddev/primary-branch-main github/fork/mwangel/master github/fork/n6g7/custom-host-port github/fork/nategiraudeau/patch-1 github/fork/nattwasm/main github/fork/nfriend/nfriend-add-_redirects-file github/fork/nicgirault/patch-1 github/fork/nickmccurdy/add-prettier-config-to-app github/fork/nickmccurdy/feature/remove-remaining-react-imports github/fork/nickmccurdy/move-e2e-tests-to-github-actions github/fork/nickmccurdy/patch-1 github/fork/nickmccurdy/patch-2 github/fork/nickmccurdy/replace-npx github/fork/nickmccurdy/revert-web-vitals github/fork/nico-martin/manifets-json-to-serviceworker github/fork/nnmax/fix/throwAnUnknowError github/fork/nvh95/file-transform github/fork/omar-bakhsh/patch-1 github/fork/oparaskos/patch-1 github/fork/opencollective/opencollective github/fork/p-avital/patch-2 github/fork/p12tic/fix-dev-server-proxy-broken-origin-header github/fork/pan-alexey/main github/fork/paramt/patch-2 github/fork/pdsouza/patch-1 github/fork/pedr0ni/main github/fork/pedro-demeu/patch-1 github/fork/pedromello/patch-1 github/fork/penx/patch-3 github/fork/ph-fritsche/update-template github/fork/phated/phated/postcss-loader-upgrade github/fork/philn5d-ar/patch-1 github/fork/pnarielwala/patch-1 github/fork/pradhul-dev/patch-1 github/fork/prichodko/feat/modern github/fork/priyankgandhi/patch-1 github/fork/proflayton/brandon/add-no-bin-link-option github/fork/pstrh/pr/increase-css-module-hash-uniqueness github/fork/purelledhand/feat/support-disable-incremental-build github/fork/pushred/resolve-url-loader-v5 github/fork/puxiao/main github/fork/qubbit/patch-1 github/fork/raix/swap-babel-out-with-swc-in-start-build-and-test github/fork/raix/v5-add-back-support-for-node-builtins github/fork/raix/v5-add-react-runtime-aliases github/fork/raix/v5-fix-react-error-overlay-build github/fork/raix/v5-fix-split-chunks-issue-prod-build github/fork/rannn505/patch-1 github/fork/redbmk/full-homepage-url github/fork/revolunet/patch-1 github/fork/rgbutov/patch-2 github/fork/rheh/main github/fork/rluvaton/use-module-ids github/fork/rojo20/react-testing-library-docs github/fork/rpivo/master github/fork/rreckonerr/patch-1 github/fork/rsylvian/patch-1 github/fork/ruckc/websocketurl github/fork/ryo-kagawa/doc-troubleshooting github/fork/ryota-murakami/feat/disableModuleScopePlugin github/fork/ryota-murakami/fix/format github/fork/sashashura/patch-1 github/fork/saurabhjdas786/patch-1 github/fork/saurabhjdas786/patch-2 github/fork/sbindass-deal/patch-1 github/fork/schalkventer/patch-1 github/fork/scottlamb/pr-print-stack github/fork/segheysens/main github/fork/serghei77/patch-1 github/fork/serranom/patch-1 github/fork/sheepsteak/paths github/fork/sheerun/wasm github/fork/shfshanyue/fix-inline-chunk github/fork/shhnjk/main github/fork/shian15810/no-const-enum github/fork/siddhantvirus/master github/fork/siddharthborderwala/patch-1 github/fork/siddtheone/patch-1 github/fork/silvareal/patch-1 github/fork/skoging/patch-2 github/fork/sumanthratna/image-optimization2 github/fork/sunil-sharma-999/main github/fork/svenliebig/master github/fork/swayamTA/test_branch github/fork/tanify/patch-1 github/fork/tanvirstreame/fix-project-directory github/fork/tanvirstreame/update-jest github/fork/tanvirstreame/update-type github/fork/tarikhamilton/patch-1 github/fork/tcope25/patch-1 github/fork/teemezzy/patch-2 github/fork/testower/patch-1 github/fork/tetedacier/patch-1 github/fork/textbook/dont-lint-deps github/fork/th13vn/main github/fork/thexpand/patch-1 github/fork/thisgeek/patch-1 github/fork/tmclo/main github/fork/tobiasbueschel/docs/docusaurus-readme github/fork/tobiasbueschel/master github/fork/tobiasbueschel/refactor/const github/fork/tomvalorsa/patch-1 github/fork/treuherz/main github/fork/trueadm/add-babel-plugin-optimize-react github/fork/unclechu/sandbox/wenzel/customizable-proxy-env-var github/fork/user7564/main github/fork/veltman/unambiguous-sourcetype github/fork/vikr01/fix/babel-env github/fork/viswa84/patch-1 github/fork/vlio20/patch-1 github/fork/webbertakken/patch-1 github/fork/wozzo/master github/fork/wsergent/patch-1 github/fork/xdiegors/patch-2 github/fork/xiaoxiangmoe/master github/fork/xtech-guru/add-less-support github/fork/yamankatby/patch-2 github/fork/yanneves/feature/no-restricted-globals github/fork/yicheny/fix_webpack5_cache_invalidation github/fork/ylemkimon/allowed-hosts github/fork/yvettep321/wp5 github/fork/zalox/master github/fork/zamarawka/feat/css-loacal-ident github/fork/zanemayo/patch-1 github/fork/zenotsai/mr/main/fix_build_cache github/fork/zhaomengfan/main github/fork/zhixiaoqiang/feature/react-dev-utils-export-guessEditor github/fork/zhoujingchao/main github/fork/zingbretsen/mdx-webpack-bugfix github/fork/zjffun/master lk/refactor-tests unpin-babel-loader wp5 v5.0.1 v5.0.0 v4.0.3 v4.0.2 v4.0.1 v4.0.0 v3.4.4 v3.4.3 v3.4.2 v3.4.1 v3.4.0 v3.3.1 v3.3.0 v3.2.0 v3.1.2 v3.1.1 v3.1.0 v3.0.1 v3.0.0 v2.1.8 v2.1.7 v2.1.6 v2.1.5 v2.1.4 v2.1.3 v2.1.2 v2.1.1 v2.1.0 v2.0.5 v2.0.4 v2.0.3 v1.1.5 v1.1.4 v1.1.3 v1.1.2 v1.1.1 v1.1.0 v1.0.17 v1.0.16 v1.0.15 v1.0.13 v1.0.12 v1.0.11 v1.0.10 v1.0.9 v1.0.8 v1.0.7 v1.0.6 v1.0.5 v1.0.4 v1.0.3 v1.0.2 v1.0.1 v1.0.0 v0.9.5 v0.9.4 v0.9.3 v0.9.2 v0.9.1 v0.9.0 v0.8.5 v0.8.4 v0.8.3 v0.8.2 v0.8.1 v0.8.1-babel-fixes+public-url v0.8.0 v0.7.0 v0.6.1 v0.6.0 v0.5.1 v0.5.0 v0.4.3 v0.4.2 v0.4.1 v0.4.0 v0.3.1 v0.3.0 timer-react-scripts@0.8.2 timer-react-scripts@0.7.1 reset react-scripts@5.0.1 react-scripts@5.0.0 react-scripts@4.0.3 react-scripts@4.0.2 react-scripts@4.0.1 react-scripts@4.0.0 react-scripts@3.4.1 react-scripts@3.4.0 react-scripts@3.3.1 react-scripts@3.3.0 react-scripts@3.2.0 react-scripts@3.1.2 react-scripts@3.1.1 react-scripts@3.1.0 react-scripts@3.0.1 react-scripts@3.0.0 react-scripts@2.1.8 react-scripts@2.1.7 react-scripts@2.1.6 react-scripts@2.1.5 react-scripts@2.1.4 react-scripts@2.1.3 react-scripts@2.1.2 react-scripts@2.1.1 react-scripts@2.1.0 react-scripts@2.0.4 react-scripts@2.0.3 react-scripts@2.0.2 react-scripts@2.0.1 react-scripts@2.0.0 react-scripts@1.1.4 react-scripts@1.1.3 react-scripts@1.1.2 react-scripts@1.1.1 react-scripts@1.1.0 react-scripts@1.0.17 react-scripts@1.0.16 react-scripts@1.0.15 react-scripts@1.0.14 react-scripts@1.0.13 react-scripts@1.0.12 react-scripts@1.0.11 react-scripts@1.0.10 react-scripts@1.0.9 react-scripts@1.0.8 react-scripts@1.0.7 react-scripts@1.0.6 react-scripts@1.0.5 react-scripts@1.0.4 react-scripts@1.0.3 react-scripts@1.0.2 react-scripts@1.0.1 react-scripts@1.0.0 react-scripts@0.9.5 react-scripts@0.9.4 react-scripts@0.9.3 react-scripts@0.9.1 react-scripts@0.9.0 react-scripts@0.8.5 react-scripts@0.8.4 react-scripts@0.8.3 react-scripts@0.8.2 react-scripts@0.8.1 react-scripts@0.8.0 react-scripts@0.7.0 react-scripts@0.6.1 react-scripts@0.5.0 react-error-overlay@6.0.11 react-error-overlay@6.0.10 react-error-overlay@6.0.9 react-error-overlay@6.0.8 react-error-overlay@6.0.7 react-error-overlay@6.0.6 react-error-overlay@6.0.5 react-error-overlay@6.0.4 react-error-overlay@6.0.3 react-error-overlay@6.0.2 react-error-overlay@6.0.1 react-error-overlay@6.0.0 react-error-overlay@5.1.6 react-error-overlay@5.1.5 react-error-overlay@5.1.4 react-error-overlay@5.1.3 react-error-overlay@5.1.2 react-error-overlay@5.1.1 react-error-overlay@5.1.0 react-error-overlay@5.0.6 react-error-overlay@5.0.4 react-error-overlay@5.0.3 react-error-overlay@5.0.2 react-error-overlay@5.0.1 react-error-overlay@4.0.0 react-error-overlay@3.0.0 react-error-overlay@2.0.2 react-error-overlay@2.0.1 react-error-overlay@2.0.0 react-error-overlay@1.0.10 react-error-overlay@1.0.9 react-error-overlay@1.0.8 react-error-overlay@1.0.7 react-error-overlay@1.0.6 react-error-overlay@1.0.5 react-error-overlay@1.0.4 react-error-overlay@1.0.3 react-error-overlay@1.0.2 react-error-overlay@1.0.1 react-error-overlay@1.0.0 react-dev-utils@12.0.1 react-dev-utils@12.0.0 react-dev-utils@11.0.3 react-dev-utils@11.0.2 react-dev-utils@11.0.1 react-dev-utils@11.0.0 react-dev-utils@10.2.1 react-dev-utils@10.2.0 react-dev-utils@10.1.0 react-dev-utils@10.0.0 react-dev-utils@9.1.0 react-dev-utils@9.0.4 react-dev-utils@9.0.3 react-dev-utils@9.0.2 react-dev-utils@9.0.1 react-dev-utils@9.0.0 react-dev-utils@8.0.0 react-dev-utils@7.0.5 react-dev-utils@7.0.4 react-dev-utils@7.0.3 react-dev-utils@7.0.2 react-dev-utils@7.0.1 react-dev-utils@7.0.0 react-dev-utils@6.1.1 react-dev-utils@6.1.0 react-dev-utils@6.0.4 react-dev-utils@6.0.3 react-dev-utils@6.0.2 react-dev-utils@6.0.1 react-dev-utils@5.0.1 react-dev-utils@5.0.0 react-dev-utils@4.2.1 react-dev-utils@4.2.0 react-dev-utils@4.1.0 react-dev-utils@4.0.1 react-dev-utils@4.0.0 react-dev-utils@3.1.0 react-dev-utils@3.0.2 react-dev-utils@3.0.1 react-dev-utils@3.0.0 react-dev-utils@2.0.1 react-dev-utils@2.0.0 react-dev-utils@1.0.3 react-dev-utils@1.0.2 react-dev-utils@1.0.1 react-dev-utils@1.0.0 react-dev-utils@0.5.2 react-dev-utils@0.5.1 react-dev-utils@0.5.0 react-dev-utils@0.4.2 react-dev-utils@0.4.0 react-dev-utils@0.3.0 react-dev-utils@0.2.1 react-dev-utils@0.1.0 react-app-polyfill@3.0.0 react-app-polyfill@2.0.0 react-app-polyfill@1.0.6 react-app-polyfill@1.0.5 react-app-polyfill@1.0.4 react-app-polyfill@1.0.3 react-app-polyfill@1.0.2 react-app-polyfill@1.0.1 react-app-polyfill@1.0.0 react-app-polyfill@0.2.2 react-app-polyfill@0.2.1 react-app-polyfill@0.2.0 react-app-polyfill@0.1.3 react-app-polyfill@0.1.2 react-app-polyfill@0.1.1 eslint-config-react-app@7.0.1 eslint-config-react-app@7.0.0 eslint-config-react-app@6.0.0 eslint-config-react-app@5.2.1 eslint-config-react-app@5.2.0 eslint-config-react-app@5.1.0 eslint-config-react-app@5.0.2 eslint-config-react-app@5.0.1 eslint-config-react-app@5.0.0 eslint-config-react-app@4.0.1 eslint-config-react-app@4.0.0 eslint-config-react-app@3.0.8 eslint-config-react-app@3.0.7 eslint-config-react-app@3.0.6 eslint-config-react-app@3.0.5 eslint-config-react-app@3.0.3 eslint-config-react-app@3.0.2 eslint-config-react-app@3.0.1 eslint-config-react-app@2.1.0 eslint-config-react-app@2.0.1 eslint-config-react-app@2.0.0 eslint-config-react-app@1.0.5 eslint-config-react-app@1.0.4 eslint-config-react-app@1.0.3 eslint-config-react-app@1.0.2 eslint-config-react-app@1.0.1 eslint-config-react-app@1.0.0 eslint-config-react-app@0.6.2 eslint-config-react-app@0.6.1 eslint-config-react-app@0.5.2 eslint-config-react-app@0.5.1 eslint-config-react-app@0.4.0 eslint-config-react-app@0.3.0 eslint-config-react-app@0.2.1 create-react-app@5.0.1 create-react-app@5.0.0 create-react-app@4.0.3 create-react-app@4.0.2 create-react-app@4.0.1 create-react-app@4.0.0 create-react-app@3.4.1 create-react-app@3.4.0 create-react-app@3.3.1 create-react-app@3.3.0 create-react-app@3.2.0 create-react-app@3.1.2 create-react-app@3.1.1 create-react-app@3.1.0 create-react-app@3.0.1 create-react-app@3.0.0 create-react-app@2.1.8 create-react-app@2.1.7 create-react-app@2.1.6 create-react-app@2.1.5 create-react-app@2.1.4 create-react-app@2.1.3 create-react-app@2.1.2 create-react-app@2.1.1 create-react-app@2.1.0 create-react-app@2.0.3 create-react-app@2.0.2 create-react-app@2.0.1 create-react-app@1.5.2 create-react-app@1.5.0 create-react-app@1.4.3 create-react-app@1.4.1 create-react-app@1.4.0 create-react-app@1.3.3 create-react-app@1.3.2 create-react-app@1.3.1 create-react-app@1.3.0 create-react-app@1.2.0 create-react-app@1.1.0 create-react-app@1.0.4 create-react-app@1.0.3 create-react-app@1.0.2 create-react-app@1.0.1 create-react-app@1.0.0 create-react-app@0.7.0 create-react-app@0.6.0 create-react-app@0.5.0 cra-template-typescript@1.2.0 cra-template-typescript@1.1.3 cra-template-typescript@1.1.2 cra-template-typescript@1.1.1 cra-template-typescript@1.1.0 cra-template-typescript@1.0.3 cra-template-typescript@1.0.2 cra-template-typescript@1.0.1 cra-template-typescript@1.0.0 cra-template@1.2.0 cra-template@1.1.3 cra-template@1.1.2 cra-template@1.1.1 cra-template@1.1.0 cra-template@1.0.3 cra-template@1.0.2 cra-template@1.0.1 cra-template@1.0.0 confusing-browser-globals@1.0.11 confusing-browser-globals@1.0.10 confusing-browser-globals@1.0.9 confusing-browser-globals@1.0.8 confusing-browser-globals@1.0.7 confusing-browser-globals@1.0.6 confusing-browser-globals@1.0.5 confusing-browser-globals@1.0.3 confusing-browser-globals@1.0.2 babel-preset-react-app@10.0.1 babel-preset-react-app@10.0.0 babel-preset-react-app@9.1.2 babel-preset-react-app@9.1.1 babel-preset-react-app@9.1.0 babel-preset-react-app@9.0.2 babel-preset-react-app@9.0.1 babel-preset-react-app@9.0.0 babel-preset-react-app@8.0.0 babel-preset-react-app@7.0.2 babel-preset-react-app@7.0.1 babel-preset-react-app@7.0.0 babel-preset-react-app@6.1.0 babel-preset-react-app@6.0.0 babel-preset-react-app@5.0.3 babel-preset-react-app@5.0.2 babel-preset-react-app@5.0.1 babel-preset-react-app@5.0.0 babel-preset-react-app@3.1.1 babel-preset-react-app@3.1.0 babel-preset-react-app@3.0.3 babel-preset-react-app@3.0.2 babel-preset-react-app@3.0.1 babel-preset-react-app@3.0.0 babel-preset-react-app@2.2.0 babel-preset-react-app@2.1.1 babel-preset-react-app@2.1.0 babel-preset-react-app@2.0.0 babel-preset-react-app@1.0.0 babel-preset-react-app@0.2.1 babel-plugin-named-asset-import@0.3.8 babel-plugin-named-asset-import@0.3.7 babel-plugin-named-asset-import@0.3.6 babel-plugin-named-asset-import@0.3.5 babel-plugin-named-asset-import@0.3.4 babel-plugin-named-asset-import@0.3.3 babel-plugin-named-asset-import@0.3.2 babel-plugin-named-asset-import@0.3.1 babel-plugin-named-asset-import@0.3.0 babel-plugin-named-asset-import@0.2.3 babel-plugin-named-asset-import@0.2.2 babel-plugin-named-asset-import@0.2.1
No related merge requests found
Showing with 203 additions and 21 deletions
+203 -21
...@@ -8,19 +8,31 @@ ...@@ -8,19 +8,31 @@
*/ */
module.exports = { module.exports = {
// Don't try to find .babelrc because we want to force this configuration.
babelrc: false, babelrc: false,
// This is a feature of `babel-loader` for webpack (not Babel itself).
// It enables caching results in OS temporary directory for faster rebuilds.
cacheDirectory: true, cacheDirectory: true,
presets: [ presets: [
// let, const, destructuring, classes, modules
require.resolve('babel-preset-es2015'), require.resolve('babel-preset-es2015'),
// exponentiation
require.resolve('babel-preset-es2016'), require.resolve('babel-preset-es2016'),
// JSX, Flow
require.resolve('babel-preset-react') require.resolve('babel-preset-react')
], ],
plugins: [ plugins: [
// function x(a, b, c,) { }
require.resolve('babel-plugin-syntax-trailing-function-commas'), require.resolve('babel-plugin-syntax-trailing-function-commas'),
// await fetch()
require.resolve('babel-plugin-syntax-async-functions'), require.resolve('babel-plugin-syntax-async-functions'),
// class { handleClick = () => { } }
require.resolve('babel-plugin-transform-class-properties'), require.resolve('babel-plugin-transform-class-properties'),
// { ...todo, completed: true }
require.resolve('babel-plugin-transform-object-rest-spread'), require.resolve('babel-plugin-transform-object-rest-spread'),
// function* () { yield 42; yield 43; }
require.resolve('babel-plugin-transform-regenerator'), require.resolve('babel-plugin-transform-regenerator'),
// Polyfills the runtime needed for async/await and generators
[require.resolve('babel-plugin-transform-runtime'), { [require.resolve('babel-plugin-transform-runtime'), {
helpers: false, helpers: false,
polyfill: false, polyfill: false,
......
...@@ -8,23 +8,34 @@ ...@@ -8,23 +8,34 @@
*/ */
module.exports = { module.exports = {
// Don't try to find .babelrc because we want to force this configuration.
babelrc: false, babelrc: false,
presets: [ presets: [
// let, const, destructuring, classes, modules
require.resolve('babel-preset-es2015'), require.resolve('babel-preset-es2015'),
// exponentiation
require.resolve('babel-preset-es2016'), require.resolve('babel-preset-es2016'),
// JSX, Flow
require.resolve('babel-preset-react') require.resolve('babel-preset-react')
], ],
plugins: [ plugins: [
// function x(a, b, c,) { }
require.resolve('babel-plugin-syntax-trailing-function-commas'), require.resolve('babel-plugin-syntax-trailing-function-commas'),
// await fetch()
require.resolve('babel-plugin-syntax-async-functions'), require.resolve('babel-plugin-syntax-async-functions'),
// class { handleClick = () => { } }
require.resolve('babel-plugin-transform-class-properties'), require.resolve('babel-plugin-transform-class-properties'),
// { ...todo, completed: true }
require.resolve('babel-plugin-transform-object-rest-spread'), require.resolve('babel-plugin-transform-object-rest-spread'),
require.resolve('babel-plugin-transform-react-constant-elements'), // function* () { yield 42; yield 43; }
require.resolve('babel-plugin-transform-regenerator'), require.resolve('babel-plugin-transform-regenerator'),
// Polyfills the runtime needed for async/await and generators
[require.resolve('babel-plugin-transform-runtime'), { [require.resolve('babel-plugin-transform-runtime'), {
helpers: false, helpers: false,
polyfill: false, polyfill: false,
regenerator: true regenerator: true
}] }],
// Optimization: hoist JSX that never changes out of render()
require.resolve('babel-plugin-transform-react-constant-elements')
] ]
}; };
...@@ -7,6 +7,9 @@ ...@@ -7,6 +7,9 @@
* of patent rights can be found in the PATENTS file in the same directory. * of patent rights can be found in the PATENTS file in the same directory.
*/ */
// Grab NODE_ENV and REACT_APP_* environment variables and prepare them to be
// injected into the application via DefinePlugin in Webpack configuration.
var REACT_APP = /^REACT_APP_/i; var REACT_APP = /^REACT_APP_/i;
var NODE_ENV = JSON.stringify(process.env.NODE_ENV || 'development'); var NODE_ENV = JSON.stringify(process.env.NODE_ENV || 'development');
......
...@@ -6,4 +6,5 @@ if (typeof Promise === 'undefined') { ...@@ -6,4 +6,5 @@ if (typeof Promise === 'undefined') {
window.Promise = require('promise/lib/es6-extensions.js'); window.Promise = require('promise/lib/es6-extensions.js');
} }
// fetch() polyfill for making API calls.
require('whatwg-fetch'); require('whatwg-fetch');
...@@ -16,22 +16,56 @@ var WatchMissingNodeModulesPlugin = require('../scripts/utils/WatchMissingNodeMo ...@@ -16,22 +16,56 @@ var WatchMissingNodeModulesPlugin = require('../scripts/utils/WatchMissingNodeMo
var paths = require('./paths'); var paths = require('./paths');
var env = require('./env'); var env = require('./env');
// This is the development configuration.
// It is focused on developer experience and fast rebuilds.
// The production configuration is different and lives in a separate file.
module.exports = { module.exports = {
// This makes the bundle appear split into separate modules in the devtools.
// We don't use source maps here because they can be confusing:
// https://github.com/facebookincubator/create-react-app/issues/343#issuecomment-237241875
// You may want 'cheap-module-source-map' instead if you prefer source maps.
devtool: 'eval', devtool: 'eval',
// These are the "entry points" to our application.
// This means they will be the "root" imports that are included in JS bundle.
// The first two entry points enable "hot" CSS and auto-refreshes for JS.
entry: [ entry: [
// Include WebpackDevServer client. It connects to WebpackDevServer via
// sockets and waits for recompile notifications. When WebpackDevServer
// recompiles, it sends a message to the client by socket. If only CSS
// was changed, the app reload just the CSS. Otherwise, it will refresh.
// The "?/" bit at the end tells the client to look for the socket at
// the root path, i.e. /sockjs-node/. Otherwise visiting a client-side
// route like /todos/42 would make it wrongly request /todos/42/sockjs-node.
// The socket server is a part of WebpackDevServer which we are using.
// The /sockjs-node/ path I'm referring to is hardcoded in WebpackDevServer.
require.resolve('webpack-dev-server/client') + '?/', require.resolve('webpack-dev-server/client') + '?/',
// Include Webpack hot module replacement runtime. Webpack is pretty
// low-level so we need to put all the pieces together. The runtime listens
// to the events received by the client above, and applies updates (such as
// new CSS) to the running application.
require.resolve('webpack/hot/dev-server'), require.resolve('webpack/hot/dev-server'),
// We ship a few polyfills by default.
require.resolve('./polyfills'), require.resolve('./polyfills'),
// Finally, this is your app's code:
path.join(paths.appSrc, 'index') path.join(paths.appSrc, 'index')
// We include the app code last so that if there is a runtime error during
// initialization, it doesn't blow up the WebpackDevServer client, and
// changing JS code would still trigger a refresh.
], ],
output: { output: {
// Next line is not used in dev but WebpackDevServer crashes without it: // Next line is not used in dev but WebpackDevServer crashes without it:
path: paths.appBuild, path: paths.appBuild,
// Add /* filename */ comments to generated require()s in the output.
pathinfo: true, pathinfo: true,
// This does not produce a real file. It's just the virtual path that is
// served by WebpackDevServer in development. This is the JS bundle
// containing code from all our entry points, and the Webpack runtime.
filename: 'static/js/bundle.js', filename: 'static/js/bundle.js',
// In development, we always serve from the root. This makes config easier.
publicPath: '/' publicPath: '/'
}, },
resolve: { resolve: {
// These are the reasonable defaults supported by the Node ecosystem.
extensions: ['.js', '.json', ''], extensions: ['.js', '.json', ''],
alias: { alias: {
// This `alias` section can be safely removed after ejection. // This `alias` section can be safely removed after ejection.
...@@ -45,11 +79,16 @@ module.exports = { ...@@ -45,11 +79,16 @@ module.exports = {
'babel-runtime/regenerator': require.resolve('babel-runtime/regenerator') 'babel-runtime/regenerator': require.resolve('babel-runtime/regenerator')
} }
}, },
// Resolve loaders (webpack plugins for CSS, images, transpilation) from the
// directory of `react-scripts` itself rather than the project directory.
// You can remove this after ejecting.
resolveLoader: { resolveLoader: {
root: paths.ownNodeModules, root: paths.ownNodeModules,
moduleTemplates: ['*-loader'] moduleTemplates: ['*-loader']
}, },
module: { module: {
// First, run the linter.
// It's important to do this before Babel processes the JS.
preLoaders: [ preLoaders: [
{ {
test: /\.js$/, test: /\.js$/,
...@@ -58,22 +97,33 @@ module.exports = { ...@@ -58,22 +97,33 @@ module.exports = {
} }
], ],
loaders: [ loaders: [
// Process JS with Babel.
{ {
test: /\.js$/, test: /\.js$/,
include: paths.appSrc, include: paths.appSrc,
loader: 'babel', loader: 'babel',
query: require('./babel.dev') query: require('./babel.dev')
}, },
// "postcss" loader applies autoprefixer to our CSS.
// "css" loader resolves paths in CSS and adds assets as dependencies.
// "style" loader turns CSS into JS modules that inject <style> tags.
// In production, we use a plugin to extract that CSS to a file, but
// in development "style" loader enables hot editing of CSS.
{ {
test: /\.css$/, test: /\.css$/,
include: [paths.appSrc, paths.appNodeModules], include: [paths.appSrc, paths.appNodeModules],
loader: 'style!css!postcss' loader: 'style!css!postcss'
}, },
// JSON is not enabled by default in Webpack but both Node and Browserify
// allow it implicitly so we also enable it.
{ {
test: /\.json$/, test: /\.json$/,
include: [paths.appSrc, paths.appNodeModules], include: [paths.appSrc, paths.appNodeModules],
loader: 'json' loader: 'json'
}, },
// "file" loader makes sure those assets get served by WebpackDevServer.
// When you `import` an asset, you get its (virtual) filename.
// In production, they would get copied to the `build` folder.
{ {
test: /\.(jpg|png|gif|eot|svg|ttf|woff|woff2)(\?.*)?$/, test: /\.(jpg|png|gif|eot|svg|ttf|woff|woff2)(\?.*)?$/,
include: [paths.appSrc, paths.appNodeModules], include: [paths.appSrc, paths.appNodeModules],
...@@ -82,6 +132,8 @@ module.exports = { ...@@ -82,6 +132,8 @@ module.exports = {
name: 'static/media/[name].[ext]' name: 'static/media/[name].[ext]'
} }
}, },
// "url" loader works just like "file" loader but it also embeds
// assets smaller than specified size as data URLs to avoid requests.
{ {
test: /\.(mp4|webm)(\?.*)?$/, test: /\.(mp4|webm)(\?.*)?$/,
include: [paths.appSrc, paths.appNodeModules], include: [paths.appSrc, paths.appNodeModules],
...@@ -93,10 +145,12 @@ module.exports = { ...@@ -93,10 +145,12 @@ module.exports = {
} }
] ]
}, },
// Point ESLint to our predefined config.
eslint: { eslint: {
configFile: path.join(__dirname, 'eslint.js'), configFile: path.join(__dirname, 'eslint.js'),
useEslintrc: false useEslintrc: false
}, },
// We use PostCSS for autoprefixing only.
postcss: function() { postcss: function() {
return [ return [
autoprefixer({ autoprefixer({
...@@ -104,21 +158,31 @@ module.exports = { ...@@ -104,21 +158,31 @@ module.exports = {
'>1%', '>1%',
'last 4 versions', 'last 4 versions',
'Firefox ESR', 'Firefox ESR',
'not ie < 9', 'not ie < 9', // React doesn't support IE8 anyway
] ]
}), }),
]; ];
}, },
plugins: [ plugins: [
// Generates an `index.html` file with the <script> injected.
new HtmlWebpackPlugin({ new HtmlWebpackPlugin({
inject: true, inject: true,
template: paths.appHtml, template: paths.appHtml,
favicon: paths.appFavicon, favicon: paths.appFavicon,
}), }),
// Makes some environment variables available to the JS code, for example:
// if (process.env.NODE_ENV === 'development') { ... }. See `env.js`.
new webpack.DefinePlugin(env), new webpack.DefinePlugin(env),
// Note: only CSS is currently hot reloaded // This is necessary to emit hot updates (currently CSS only):
new webpack.HotModuleReplacementPlugin(), new webpack.HotModuleReplacementPlugin(),
// Watcher doesn't work well if you mistype casing in a path so we use
// a plugin that prints an error when you attempt to do this.
// See https://github.com/facebookincubator/create-react-app/issues/240
new CaseSensitivePathsPlugin(), new CaseSensitivePathsPlugin(),
// If you require a missing module and then `npm install` it, you still have
// to restart the development server for Webpack to discover it. This plugin
// makes the discovery automatic so you don't have to restart.
// See https://github.com/facebookincubator/create-react-app/issues/186
new WatchMissingNodeModulesPlugin(paths.appNodeModules) new WatchMissingNodeModulesPlugin(paths.appNodeModules)
] ]
}; };
...@@ -16,27 +16,51 @@ var url = require('url'); ...@@ -16,27 +16,51 @@ var url = require('url');
var paths = require('./paths'); var paths = require('./paths');
var env = require('./env'); var env = require('./env');
// Assert this just to be safe.
// Development builds of React are slow and not intended for production.
if (env['process.env.NODE_ENV'] !== '"production"') {
throw new Error('Production builds must have NODE_ENV=production.');
}
// We use "homepage" field to infer "public path" at which the app is served.
// Webpack needs to know it to put the right <script> hrefs into HTML even in
// single-page apps that may serve index.html for nested URLs like /todos/42.
// We can't use a relative path in HTML because we don't want to load something
// like /todos/42/static/js/bundle.7289d.js. We have to know the root.
var homepagePath = require(paths.appPackageJson).homepage; var homepagePath = require(paths.appPackageJson).homepage;
var publicPath = homepagePath ? url.parse(homepagePath).pathname : '/'; var publicPath = homepagePath ? url.parse(homepagePath).pathname : '/';
if (!publicPath.endsWith('/')) { if (!publicPath.endsWith('/')) {
// Prevents incorrect paths in file-loader // If we don't do this, file assets will get incorrect paths.
publicPath += '/'; publicPath += '/';
} }
// This is the production configuration.
// It compiles slowly and is focused on producing a fast and minimal bundle.
// The development configuration is different and lives in a separate file.
module.exports = { module.exports = {
// Don't attempt to continue if there are any errors.
bail: true, bail: true,
// We generate sourcemaps in production. This is slow but gives good results.
// You can exclude the *.map files from the build during deployment.
devtool: 'source-map', devtool: 'source-map',
// In production, we only want to load the polyfills and the app code.
entry: [ entry: [
require.resolve('./polyfills'), require.resolve('./polyfills'),
path.join(paths.appSrc, 'index') path.join(paths.appSrc, 'index')
], ],
output: { output: {
// The build folder.
path: paths.appBuild, path: paths.appBuild,
// Generated JS file names (with nested folders).
// There will be one main bundle, and one file per asynchronous chunk.
// We don't currently advertise code splitting but Webpack supports it.
filename: 'static/js/[name].[chunkhash:8].js', filename: 'static/js/[name].[chunkhash:8].js',
chunkFilename: 'static/js/[name].[chunkhash:8].chunk.js', chunkFilename: 'static/js/[name].[chunkhash:8].chunk.js',
// We inferred the "public path" (such as / or /my-project) from homepage.
publicPath: publicPath publicPath: publicPath
}, },
resolve: { resolve: {
// These are the reasonable defaults supported by the Node ecosystem.
extensions: ['.js', '.json', ''], extensions: ['.js', '.json', ''],
alias: { alias: {
// This `alias` section can be safely removed after ejection. // This `alias` section can be safely removed after ejection.
...@@ -50,11 +74,16 @@ module.exports = { ...@@ -50,11 +74,16 @@ module.exports = {
'babel-runtime/regenerator': require.resolve('babel-runtime/regenerator') 'babel-runtime/regenerator': require.resolve('babel-runtime/regenerator')
} }
}, },
// Resolve loaders (webpack plugins for CSS, images, transpilation) from the
// directory of `react-scripts` itself rather than the project directory.
// You can remove this after ejecting.
resolveLoader: { resolveLoader: {
root: paths.ownNodeModules, root: paths.ownNodeModules,
moduleTemplates: ['*-loader'] moduleTemplates: ['*-loader']
}, },
module: { module: {
// First, run the linter.
// It's important to do this before Babel processes the JS.
preLoaders: [ preLoaders: [
{ {
test: /\.js$/, test: /\.js$/,
...@@ -63,26 +92,44 @@ module.exports = { ...@@ -63,26 +92,44 @@ module.exports = {
} }
], ],
loaders: [ loaders: [
// Process JS with Babel.
{ {
test: /\.js$/, test: /\.js$/,
include: paths.appSrc, include: paths.appSrc,
loader: 'babel', loader: 'babel',
query: require('./babel.prod') query: require('./babel.prod')
}, },
// The notation here is somewhat confusing.
// "postcss" loader applies autoprefixer to our CSS.
// "css" loader resolves paths in CSS and adds assets as dependencies.
// "style" loader normally turns CSS into JS modules injecting <style>,
// but unlike in development configuration, we do something different.
// `ExtractTextPlugin` first applies the "postcss" and "css" loaders
// (second argument), then grabs the result CSS and puts it into a
// separate file in our build process. This way we actually ship
// a single CSS file in production instead of JS code injecting <style>
// tags. If you use code splitting, however, any async bundles will still
// use the "style" loader inside the async code so CSS from them won't be
// in the main CSS file.
{ {
test: /\.css$/, test: /\.css$/,
include: [paths.appSrc, paths.appNodeModules], include: [paths.appSrc, paths.appNodeModules],
// Disable autoprefixer in css-loader itself: // "?-autoprefixer" disables autoprefixer in css-loader itself:
// https://github.com/webpack/css-loader/issues/281 // https://github.com/webpack/css-loader/issues/281
// We already have it thanks to postcss. // We already have it thanks to postcss.
loader: ExtractTextPlugin.extract('style', 'css?-autoprefixer!postcss') loader: ExtractTextPlugin.extract('style', 'css?-autoprefixer!postcss')
// Note: this won't work without `new ExtractTextPlugin()` in `plugins`.
}, },
{ {
// JSON is not enabled by default in Webpack but both Node and Browserify
// allow it implicitly so we also enable it.
test: /\.json$/, test: /\.json$/,
include: [paths.appSrc, paths.appNodeModules], include: [paths.appSrc, paths.appNodeModules],
loader: 'json' loader: 'json'
}, },
{ {
// "file" loader makes sure those assets end up in the `build` folder.
// When you `import` an asset, you get its filename.
test: /\.(jpg|png|gif|eot|svg|ttf|woff|woff2)(\?.*)?$/, test: /\.(jpg|png|gif|eot|svg|ttf|woff|woff2)(\?.*)?$/,
include: [paths.appSrc, paths.appNodeModules], include: [paths.appSrc, paths.appNodeModules],
loader: 'file', loader: 'file',
...@@ -90,6 +137,8 @@ module.exports = { ...@@ -90,6 +137,8 @@ module.exports = {
name: 'static/media/[name].[hash:8].[ext]' name: 'static/media/[name].[hash:8].[ext]'
} }
}, },
// "url" loader works just like "file" loader but it also embeds
// assets smaller than specified size as data URLs to avoid requests.
{ {
test: /\.(mp4|webm)(\?.*)?$/, test: /\.(mp4|webm)(\?.*)?$/,
include: [paths.appSrc, paths.appNodeModules], include: [paths.appSrc, paths.appNodeModules],
...@@ -101,12 +150,14 @@ module.exports = { ...@@ -101,12 +150,14 @@ module.exports = {
} }
] ]
}, },
// Point ESLint to our predefined config.
eslint: { eslint: {
// TODO: consider separate config for production, // TODO: consider separate config for production,
// e.g. to enable no-console and no-debugger only in prod. // e.g. to enable no-console and no-debugger only in production.
configFile: path.join(__dirname, 'eslint.js'), configFile: path.join(__dirname, 'eslint.js'),
useEslintrc: false useEslintrc: false
}, },
// We use PostCSS for autoprefixing only.
postcss: function() { postcss: function() {
return [ return [
autoprefixer({ autoprefixer({
...@@ -114,12 +165,13 @@ module.exports = { ...@@ -114,12 +165,13 @@ module.exports = {
'>1%', '>1%',
'last 4 versions', 'last 4 versions',
'Firefox ESR', 'Firefox ESR',
'not ie < 9', 'not ie < 9', // React doesn't support IE8 anyway
] ]
}), }),
]; ];
}, },
plugins: [ plugins: [
// Generates an `index.html` file with the <script> injected.
new HtmlWebpackPlugin({ new HtmlWebpackPlugin({
inject: true, inject: true,
template: paths.appHtml, template: paths.appHtml,
...@@ -137,12 +189,19 @@ module.exports = { ...@@ -137,12 +189,19 @@ module.exports = {
minifyURLs: true minifyURLs: true
} }
}), }),
// Makes some environment variables available to the JS code, for example:
// if (process.env.NODE_ENV === 'production') { ... }. See `env.js`.
// It is absolutely essential that NODE_ENV was set to production here.
// Otherwise React will be compiled in the very slow development mode.
new webpack.DefinePlugin(env), new webpack.DefinePlugin(env),
// This helps ensure the builds are consistent if source hasn't changed:
new webpack.optimize.OccurrenceOrderPlugin(), new webpack.optimize.OccurrenceOrderPlugin(),
// Try to dedupe duplicated modules, if any:
new webpack.optimize.DedupePlugin(), new webpack.optimize.DedupePlugin(),
// Minify the code.
new webpack.optimize.UglifyJsPlugin({ new webpack.optimize.UglifyJsPlugin({
compress: { compress: {
screw_ie8: true, screw_ie8: true, // React doesn't support IE8
warnings: false warnings: false
}, },
mangle: { mangle: {
...@@ -153,6 +212,7 @@ module.exports = { ...@@ -153,6 +212,7 @@ module.exports = {
screw_ie8: true screw_ie8: true
} }
}), }),
// Note: this won't work without ExtractTextPlugin.extract(..) in `loaders`.
new ExtractTextPlugin('static/css/[name].[contenthash:8].css') new ExtractTextPlugin('static/css/[name].[contenthash:8].css')
] ]
}; };
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
* of patent rights can be found in the PATENTS file in the same directory. * of patent rights can be found in the PATENTS file in the same directory.
*/ */
// Do this as the first thing so that any code reading it knows the right env.
process.env.NODE_ENV = 'production'; process.env.NODE_ENV = 'production';
var chalk = require('chalk'); var chalk = require('chalk');
...@@ -21,12 +22,16 @@ var paths = require('../config/paths'); ...@@ -21,12 +22,16 @@ var paths = require('../config/paths');
var recursive = require('recursive-readdir'); var recursive = require('recursive-readdir');
var stripAnsi = require('strip-ansi'); var stripAnsi = require('strip-ansi');
// Input: /User/dan/app/build/static/js/main.82be8.js
// Output: /static/js/main.js
function removeFileNameHash(fileName) { function removeFileNameHash(fileName) {
return fileName return fileName
.replace(paths.appBuild, '') .replace(paths.appBuild, '')
.replace(/\/?(.*)(\.\w+)(\.js|\.css)/, (match, p1, p2, p3) => p1 + p3); .replace(/\/?(.*)(\.\w+)(\.js|\.css)/, (match, p1, p2, p3) => p1 + p3);
} }
// Input: 1024, 2048
// Output: "(+1 KB)"
function getDifferenceLabel(currentSize, previousSize) { function getDifferenceLabel(currentSize, previousSize) {
var FIFTY_KILOBYTES = 1024 * 50; var FIFTY_KILOBYTES = 1024 * 50;
var difference = currentSize - previousSize; var difference = currentSize - previousSize;
...@@ -62,6 +67,7 @@ recursive(paths.appBuild, (err, fileNames) => { ...@@ -62,6 +67,7 @@ recursive(paths.appBuild, (err, fileNames) => {
build(previousSizeMap); build(previousSizeMap);
}); });
// Print a detailed summary of build files.
function printFileSizes(stats, previousSizeMap) { function printFileSizes(stats, previousSizeMap) {
var assets = stats.toJson().assets var assets = stats.toJson().assets
.filter(asset => /\.(js|css)$/.test(asset.name)) .filter(asset => /\.(js|css)$/.test(asset.name))
...@@ -78,7 +84,6 @@ function printFileSizes(stats, previousSizeMap) { ...@@ -78,7 +84,6 @@ function printFileSizes(stats, previousSizeMap) {
}; };
}); });
assets.sort((a, b) => b.size - a.size); assets.sort((a, b) => b.size - a.size);
var longestSizeLabelLength = Math.max.apply(null, var longestSizeLabelLength = Math.max.apply(null,
assets.map(a => stripAnsi(a.sizeLabel).length) assets.map(a => stripAnsi(a.sizeLabel).length)
); );
...@@ -96,6 +101,7 @@ function printFileSizes(stats, previousSizeMap) { ...@@ -96,6 +101,7 @@ function printFileSizes(stats, previousSizeMap) {
}); });
} }
// Create the production build and print the deployment instructions.
function build(previousSizeMap) { function build(previousSizeMap) {
console.log('Creating an optimized production build...'); console.log('Creating an optimized production build...');
webpack(config).run((err, stats) => { webpack(config).run((err, stats) => {
......
...@@ -22,7 +22,7 @@ var prompt = require('./utils/prompt'); ...@@ -22,7 +22,7 @@ var prompt = require('./utils/prompt');
var config = require('../config/webpack.config.dev'); var config = require('../config/webpack.config.dev');
var paths = require('../config/paths'); var paths = require('../config/paths');
// Tools like Cloud9 rely on this // Tools like Cloud9 rely on this.
var DEFAULT_PORT = process.env.PORT || 3000; var DEFAULT_PORT = process.env.PORT || 3000;
var compiler; var compiler;
...@@ -40,15 +40,13 @@ if (isSmokeTest) { ...@@ -40,15 +40,13 @@ if (isSmokeTest) {
}; };
} }
// Some custom utilities to prettify Webpack output.
// This is a little hacky.
// It would be easier if webpack provided a rich error object.
var friendlySyntaxErrorLabel = 'Syntax error:'; var friendlySyntaxErrorLabel = 'Syntax error:';
function isLikelyASyntaxError(message) { function isLikelyASyntaxError(message) {
return message.indexOf(friendlySyntaxErrorLabel) !== -1; return message.indexOf(friendlySyntaxErrorLabel) !== -1;
} }
// This is a little hacky.
// It would be easier if webpack provided a rich error object.
function formatMessage(message) { function formatMessage(message) {
return message return message
// Make some common errors shorter: // Make some common errors shorter:
...@@ -69,17 +67,27 @@ function formatMessage(message) { ...@@ -69,17 +67,27 @@ function formatMessage(message) {
} }
function clearConsole() { function clearConsole() {
// This seems to work best on Windows and other systems.
// The intention is to clear the output so you can focus on most recent build.
process.stdout.write('\x1bc'); process.stdout.write('\x1bc');
} }
function setupCompiler(port) { function setupCompiler(port) {
// "Compiler" is a low-level interface to Webpack.
// It lets us listen to some events and provide our own custom messages.
compiler = webpack(config, handleCompile); compiler = webpack(config, handleCompile);
// "invalid" event fires when you have changed a file, and Webpack is
// recompiling a bundle. WebpackDevServer takes care to pause serving the
// bundle, so if you refresh, it'll wait instead of serving the old one.
// "invalid" is short for "bundle invalidated", it doesn't imply any errors.
compiler.plugin('invalid', function() { compiler.plugin('invalid', function() {
clearConsole(); clearConsole();
console.log('Compiling...'); console.log('Compiling...');
}); });
// "done" event fires when Webpack has finished recompiling the bundle.
// Whether or not you have warnings or errors, you will get this event.
compiler.plugin('done', function(stats) { compiler.plugin('done', function(stats) {
clearConsole(); clearConsole();
var hasErrors = stats.hasErrors(); var hasErrors = stats.hasErrors();
...@@ -94,10 +102,12 @@ function setupCompiler(port) { ...@@ -94,10 +102,12 @@ function setupCompiler(port) {
console.log('Note that the development build is not optimized.'); console.log('Note that the development build is not optimized.');
console.log('To create a production build, use ' + chalk.cyan('npm run build') + '.'); console.log('To create a production build, use ' + chalk.cyan('npm run build') + '.');
console.log(); console.log();
return; return;
} }
// We have switched off the default Webpack output in WebpackDevServer
// options so we are going to "massage" the warnings and errors and present
// them in a readable focused way.
var json = stats.toJson(); var json = stats.toJson();
var formattedErrors = json.errors.map(message => var formattedErrors = json.errors.map(message =>
'Error in ' + formatMessage(message) 'Error in ' + formatMessage(message)
...@@ -105,7 +115,6 @@ function setupCompiler(port) { ...@@ -105,7 +115,6 @@ function setupCompiler(port) {
var formattedWarnings = json.warnings.map(message => var formattedWarnings = json.warnings.map(message =>
'Warning in ' + formatMessage(message) 'Warning in ' + formatMessage(message)
); );
if (hasErrors) { if (hasErrors) {
console.log(chalk.red('Failed to compile.')); console.log(chalk.red('Failed to compile.'));
console.log(); console.log();
...@@ -122,7 +131,6 @@ function setupCompiler(port) { ...@@ -122,7 +131,6 @@ function setupCompiler(port) {
// If errors exist, ignore warnings. // If errors exist, ignore warnings.
return; return;
} }
if (hasWarnings) { if (hasWarnings) {
console.log(chalk.yellow('Compiled with warnings.')); console.log(chalk.yellow('Compiled with warnings.'));
console.log(); console.log();
...@@ -130,7 +138,7 @@ function setupCompiler(port) { ...@@ -130,7 +138,7 @@ function setupCompiler(port) {
console.log(message); console.log(message);
console.log(); console.log();
}); });
// Teach some ESLint tricks.
console.log('You may use special comments to disable some warnings.'); console.log('You may use special comments to disable some warnings.');
console.log('Use ' + chalk.yellow('// eslint-disable-next-line') + ' to ignore the next line.'); console.log('Use ' + chalk.yellow('// eslint-disable-next-line') + ' to ignore the next line.');
console.log('Use ' + chalk.yellow('/* eslint-disable */') + ' to ignore all warnings in a file.'); console.log('Use ' + chalk.yellow('/* eslint-disable */') + ' to ignore all warnings in a file.');
...@@ -207,14 +215,29 @@ function addMiddleware(devServer) { ...@@ -207,14 +215,29 @@ function addMiddleware(devServer) {
function runDevServer(port) { function runDevServer(port) {
var devServer = new WebpackDevServer(compiler, { var devServer = new WebpackDevServer(compiler, {
hot: true, // Note: only CSS is currently hot reloaded // Enable hot reloading server. It will provide /sockjs-node/ endpoint
// for the WebpackDevServer client so it can learn when the files were
// updated. The WebpackDevServer client is included as an entry point
// in the Webpack development configuration. Note that only changes
// to CSS are currently hot reloaded. JS changes will refresh the browser.
hot: true,
// It is important to tell WebpackDevServer to use the same "root" path
// as we specified in the config. In development, we always serve from /.
publicPath: config.output.publicPath, publicPath: config.output.publicPath,
// WebpackDevServer is noisy by default so we emit custom message instead
// by listening to the compiler events with `compiler.plugin` calls above.
quiet: true, quiet: true,
// Reportedly, this avoids CPU overload on some systems.
// https://github.com/facebookincubator/create-react-app/issues/293
watchOptions: { watchOptions: {
ignored: /node_modules/ ignored: /node_modules/
} }
}); });
// Our custom middleware proxies requests to /index.html or a remote API.
addMiddleware(devServer); addMiddleware(devServer);
// Launch WebpackDevServer.
devServer.listen(port, (err, result) => { devServer.listen(port, (err, result) => {
if (err) { if (err) {
return console.log(err); return console.log(err);
...@@ -232,6 +255,8 @@ function run(port) { ...@@ -232,6 +255,8 @@ function run(port) {
runDevServer(port); runDevServer(port);
} }
// We attempt to use the default port but if it is busy, we offer the user to
// run on a different port. `detect()` Promise resolves to the next free port.
detect(DEFAULT_PORT).then(port => { detect(DEFAULT_PORT).then(port => {
if (port === DEFAULT_PORT) { if (port === DEFAULT_PORT) {
run(port); run(port);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment