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

Add support for public/ folder (#703)

parent 5b85a362
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 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 202 additions and 74 deletions
+202 -74
...@@ -38,7 +38,8 @@ var nodePaths = (process.env.NODE_PATH || '') ...@@ -38,7 +38,8 @@ var nodePaths = (process.env.NODE_PATH || '')
// config after eject: we're in ./config/ // config after eject: we're in ./config/
module.exports = { module.exports = {
appBuild: resolveApp('build'), appBuild: resolveApp('build'),
appHtml: resolveApp('index.html'), appPublic: resolveApp('public'),
appHtml: resolveApp('public/index.html'),
appIndexJs: resolveApp('src/index.js'), appIndexJs: resolveApp('src/index.js'),
appPackageJson: resolveApp('package.json'), appPackageJson: resolveApp('package.json'),
appSrc: resolveApp('src'), appSrc: resolveApp('src'),
...@@ -56,7 +57,8 @@ function resolveOwn(relativePath) { ...@@ -56,7 +57,8 @@ function resolveOwn(relativePath) {
// config before eject: we're in ./node_modules/react-scripts/config/ // config before eject: we're in ./node_modules/react-scripts/config/
module.exports = { module.exports = {
appBuild: resolveApp('build'), appBuild: resolveApp('build'),
appHtml: resolveApp('index.html'), appPublic: resolveApp('public'),
appHtml: resolveApp('public/index.html'),
appIndexJs: resolveApp('src/index.js'), appIndexJs: resolveApp('src/index.js'),
appPackageJson: resolveApp('package.json'), appPackageJson: resolveApp('package.json'),
appSrc: resolveApp('src'), appSrc: resolveApp('src'),
...@@ -71,7 +73,8 @@ module.exports = { ...@@ -71,7 +73,8 @@ module.exports = {
// @remove-on-publish-begin // @remove-on-publish-begin
module.exports = { module.exports = {
appBuild: resolveOwn('../../../build'), appBuild: resolveOwn('../../../build'),
appHtml: resolveOwn('../template/index.html'), appPublic: resolveOwn('../template/public'),
appHtml: resolveOwn('../template/public/index.html'),
appIndexJs: resolveOwn('../template/src/index.js'), appIndexJs: resolveOwn('../template/src/index.js'),
appPackageJson: resolveOwn('../package.json'), appPackageJson: resolveOwn('../package.json'),
appSrc: resolveOwn('../template/src'), appSrc: resolveOwn('../template/src'),
......
...@@ -14,9 +14,20 @@ var autoprefixer = require('autoprefixer'); ...@@ -14,9 +14,20 @@ var autoprefixer = require('autoprefixer');
var webpack = require('webpack'); var webpack = require('webpack');
var HtmlWebpackPlugin = require('html-webpack-plugin'); var HtmlWebpackPlugin = require('html-webpack-plugin');
var CaseSensitivePathsPlugin = require('case-sensitive-paths-webpack-plugin'); var CaseSensitivePathsPlugin = require('case-sensitive-paths-webpack-plugin');
var InterpolateHtmlPlugin = require('../scripts/utils/InterpolateHtmlPlugin');
var WatchMissingNodeModulesPlugin = require('../scripts/utils/WatchMissingNodeModulesPlugin'); var WatchMissingNodeModulesPlugin = require('../scripts/utils/WatchMissingNodeModulesPlugin');
var getClientEnvironment = require('../scripts/utils/getClientEnvironment');
var paths = require('./paths'); var paths = require('./paths');
var env = require('./env');
// Webpack uses `publicPath` to determine where the app is being served from.
// In development, we always serve from the root. This makes config easier.
var publicPath = '/';
// `publicUrl` is just like `publicPath`, but we will provide it to our app
// as %PUBLIC_URL% in `index.html` and `process.env.PUBLIC_URL` in JavaScript.
// Omit trailing shlash as %PUBLIC_PATH%/xyz looks better than %PUBLIC_PATH%xyz.
var publicUrl = '';
// Get enrivonment variables to inject into our app.
var env = getClientEnvironment(publicUrl);
// This is the development configuration. // This is the development configuration.
// It is focused on developer experience and fast rebuilds. // It is focused on developer experience and fast rebuilds.
...@@ -63,8 +74,8 @@ module.exports = { ...@@ -63,8 +74,8 @@ module.exports = {
// served by WebpackDevServer in development. This is the JS bundle // served by WebpackDevServer in development. This is the JS bundle
// containing code from all our entry points, and the Webpack runtime. // 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. // This is the URL that app is served from. We use "/" in development.
publicPath: '/' publicPath: publicPath
}, },
resolve: { resolve: {
// This allows you to set a fallback for where Webpack should look for modules. // This allows you to set a fallback for where Webpack should look for modules.
...@@ -129,21 +140,11 @@ module.exports = { ...@@ -129,21 +140,11 @@ module.exports = {
// In production, they would get copied to the `build` folder. // In production, they would get copied to the `build` folder.
{ {
test: /\.(ico|jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2)(\?.*)?$/, test: /\.(ico|jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2)(\?.*)?$/,
exclude: /\/favicon.ico$/,
loader: 'file', loader: 'file',
query: { query: {
name: 'static/media/[name].[hash:8].[ext]' name: 'static/media/[name].[hash:8].[ext]'
} }
}, },
// A special case for favicon.ico to place it into build root directory.
{
test: /\/favicon.ico$/,
include: [paths.appSrc],
loader: 'file',
query: {
name: 'favicon.ico?[hash:8]'
}
},
// "url" loader works just like "file" loader but it also embeds // "url" loader works just like "file" loader but it also embeds
// assets smaller than specified size as data URLs to avoid requests. // assets smaller than specified size as data URLs to avoid requests.
{ {
...@@ -153,15 +154,6 @@ module.exports = { ...@@ -153,15 +154,6 @@ module.exports = {
limit: 10000, limit: 10000,
name: 'static/media/[name].[hash:8].[ext]' name: 'static/media/[name].[hash:8].[ext]'
} }
},
// "html" loader is used to process template page (index.html) to resolve
// resources linked with <link href="./relative/path"> HTML tags.
{
test: /\.html$/,
loader: 'html',
query: {
attrs: ['link:href'],
}
} }
] ]
}, },
...@@ -186,13 +178,19 @@ module.exports = { ...@@ -186,13 +178,19 @@ module.exports = {
]; ];
}, },
plugins: [ plugins: [
// Makes the public URL available as %PUBLIC_URL% in index.html, e.g.:
// <link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">
// In development, this will be an empty string.
new InterpolateHtmlPlugin({
PUBLIC_URL: publicUrl
}),
// Generates an `index.html` file with the <script> injected. // Generates an `index.html` file with the <script> injected.
new HtmlWebpackPlugin({ new HtmlWebpackPlugin({
inject: true, inject: true,
template: paths.appHtml, template: paths.appHtml,
}), }),
// Makes some environment variables available to the JS code, for example: // Makes some environment variables available to the JS code, for example:
// if (process.env.NODE_ENV === 'development') { ... }. See `env.js`. // if (process.env.NODE_ENV === 'development') { ... }.
new webpack.DefinePlugin(env), new webpack.DefinePlugin(env),
// This is necessary to emit hot updates (currently CSS only): // This is necessary to emit hot updates (currently CSS only):
new webpack.HotModuleReplacementPlugin(), new webpack.HotModuleReplacementPlugin(),
......
...@@ -16,12 +16,18 @@ var HtmlWebpackPlugin = require('html-webpack-plugin'); ...@@ -16,12 +16,18 @@ var HtmlWebpackPlugin = require('html-webpack-plugin');
var ExtractTextPlugin = require('extract-text-webpack-plugin'); var ExtractTextPlugin = require('extract-text-webpack-plugin');
var url = require('url'); var url = require('url');
var paths = require('./paths'); var paths = require('./paths');
var env = require('./env'); var InterpolateHtmlPlugin = require('../scripts/utils/InterpolateHtmlPlugin');
var getClientEnvironment = require('../scripts/utils/getClientEnvironment');
// Assert this just to be safe. function ensureSlash(path, needsSlash) {
// Development builds of React are slow and not intended for production. var hasSlash = path.endsWith('/');
if (env['process.env.NODE_ENV'] !== '"production"') { if (hasSlash && !needsSlash) {
throw new Error('Production builds must have NODE_ENV=production.'); return path.substr(path, path.length - 1);
} else if (!hasSlash && needsSlash) {
return path + '/';
} else {
return path;
}
} }
// We use "homepage" field to infer "public path" at which the app is served. // We use "homepage" field to infer "public path" at which the app is served.
...@@ -30,10 +36,21 @@ if (env['process.env.NODE_ENV'] !== '"production"') { ...@@ -30,10 +36,21 @@ if (env['process.env.NODE_ENV'] !== '"production"') {
// We can't use a relative path in HTML because we don't want to load something // 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. // 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 homepagePathname = homepagePath ? url.parse(homepagePath).pathname : '/';
if (!publicPath.endsWith('/')) { // Webpack uses `publicPath` to determine where the app is being served from.
// If we don't do this, file assets will get incorrect paths. // It requires a trailing slash, or the file assets will get an incorrect path.
publicPath += '/'; var publicPath = ensureSlash(homepagePathname, true);
// `publicUrl` is just like `publicPath`, but we will provide it to our app
// as %PUBLIC_URL% in `index.html` and `process.env.PUBLIC_URL` in JavaScript.
// Omit trailing shlash as %PUBLIC_PATH%/xyz looks better than %PUBLIC_PATH%xyz.
var publicUrl = ensureSlash(homepagePathname, false);
// Get enrivonment variables to inject into our app.
var env = getClientEnvironment(publicUrl);
// 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.');
} }
// This is the production configuration. // This is the production configuration.
...@@ -139,21 +156,11 @@ module.exports = { ...@@ -139,21 +156,11 @@ module.exports = {
// When you `import` an asset, you get its filename. // When you `import` an asset, you get its filename.
{ {
test: /\.(ico|jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2)(\?.*)?$/, test: /\.(ico|jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2)(\?.*)?$/,
exclude: /\/favicon.ico$/,
loader: 'file', loader: 'file',
query: { query: {
name: 'static/media/[name].[hash:8].[ext]' name: 'static/media/[name].[hash:8].[ext]'
} }
}, },
// A special case for favicon.ico to place it into build root directory.
{
test: /\/favicon.ico$/,
include: [paths.appSrc],
loader: 'file',
query: {
name: 'favicon.ico?[hash:8]'
}
},
// "url" loader works just like "file" loader but it also embeds // "url" loader works just like "file" loader but it also embeds
// assets smaller than specified size as data URLs to avoid requests. // assets smaller than specified size as data URLs to avoid requests.
{ {
...@@ -163,15 +170,6 @@ module.exports = { ...@@ -163,15 +170,6 @@ module.exports = {
limit: 10000, limit: 10000,
name: 'static/media/[name].[hash:8].[ext]' name: 'static/media/[name].[hash:8].[ext]'
} }
},
// "html" loader is used to process template page (index.html) to resolve
// resources linked with <link href="./relative/path"> HTML tags.
{
test: /\.html$/,
loader: 'html',
query: {
attrs: ['link:href'],
}
} }
] ]
}, },
...@@ -198,6 +196,13 @@ module.exports = { ...@@ -198,6 +196,13 @@ module.exports = {
]; ];
}, },
plugins: [ plugins: [
// Makes the public URL available as %PUBLIC_URL% in index.html, e.g.:
// <link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">
// In production, it will be an empty string unless you specify "homepage"
// in `package.json`, in which case it will be the pathname of that URL.
new InterpolateHtmlPlugin({
PUBLIC_URL: publicUrl
}),
// Generates an `index.html` file with the <script> injected. // Generates an `index.html` file with the <script> injected.
new HtmlWebpackPlugin({ new HtmlWebpackPlugin({
inject: true, inject: true,
...@@ -216,7 +221,7 @@ module.exports = { ...@@ -216,7 +221,7 @@ module.exports = {
} }
}), }),
// Makes some environment variables available to the JS code, for example: // Makes some environment variables available to the JS code, for example:
// if (process.env.NODE_ENV === 'production') { ... }. See `env.js`. // if (process.env.NODE_ENV === 'production') { ... }.
// It is absolutely essential that NODE_ENV was set to production here. // It is absolutely essential that NODE_ENV was set to production here.
// Otherwise React will be compiled in the very slow development mode. // Otherwise React will be compiled in the very slow development mode.
new webpack.DefinePlugin(env), new webpack.DefinePlugin(env),
......
...@@ -46,7 +46,6 @@ ...@@ -46,7 +46,6 @@
"find-cache-dir": "0.1.1", "find-cache-dir": "0.1.1",
"fs-extra": "0.30.0", "fs-extra": "0.30.0",
"gzip-size": "3.0.0", "gzip-size": "3.0.0",
"html-loader": "0.4.3",
"html-webpack-plugin": "2.22.0", "html-webpack-plugin": "2.22.0",
"http-proxy-middleware": "0.17.1", "http-proxy-middleware": "0.17.1",
"jest": "15.1.1", "jest": "15.1.1",
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
process.env.NODE_ENV = 'production'; process.env.NODE_ENV = 'production';
var chalk = require('chalk'); var chalk = require('chalk');
var fs = require('fs'); var fs = require('fs-extra');
var path = require('path'); var path = require('path');
var filesize = require('filesize'); var filesize = require('filesize');
var gzipSize = require('gzip-size').sync; var gzipSize = require('gzip-size').sync;
...@@ -70,6 +70,9 @@ recursive(paths.appBuild, (err, fileNames) => { ...@@ -70,6 +70,9 @@ recursive(paths.appBuild, (err, fileNames) => {
// Start the webpack build // Start the webpack build
build(previousSizeMap); build(previousSizeMap);
// Merge with the public folder
copyPublicFolder();
}); });
// Print a detailed summary of build files. // Print a detailed summary of build files.
...@@ -175,3 +178,10 @@ function build(previousSizeMap) { ...@@ -175,3 +178,10 @@ function build(previousSizeMap) {
} }
}); });
} }
function copyPublicFolder() {
fs.copySync(paths.appPublic, paths.appBuild, {
dereference: true,
filter: file => file !== paths.appHtml
});
}
...@@ -46,6 +46,8 @@ prompt( ...@@ -46,6 +46,8 @@ prompt(
path.join('scripts', 'start.js'), path.join('scripts', 'start.js'),
path.join('scripts', 'utils', 'checkRequiredFiles.js'), path.join('scripts', 'utils', 'checkRequiredFiles.js'),
path.join('scripts', 'utils', 'chrome.applescript'), path.join('scripts', 'utils', 'chrome.applescript'),
path.join('scripts', 'utils', 'getClientEnvironment.js'),
path.join('scripts', 'utils', 'InterpolateHtmlPlugin.js'),
path.join('scripts', 'utils', 'prompt.js'), path.join('scripts', 'utils', 'prompt.js'),
path.join('scripts', 'utils', 'WatchMissingNodeModulesPlugin.js') path.join('scripts', 'utils', 'WatchMissingNodeModulesPlugin.js')
]; ];
......
...@@ -255,23 +255,21 @@ function runDevServer(port, protocol) { ...@@ -255,23 +255,21 @@ function runDevServer(port, protocol) {
// Silence WebpackDevServer's own logs since they're generally not useful. // Silence WebpackDevServer's own logs since they're generally not useful.
// It will still show compile warnings and errors with this setting. // It will still show compile warnings and errors with this setting.
clientLogLevel: 'none', clientLogLevel: 'none',
// By default WebpackDevServer also serves files from the current directory. // By default WebpackDevServer serves physical files from current directory
// This might be useful in legacy apps. However we already encourage people // in addition to all the virtual build products that it serves from memory.
// to use Webpack for importing assets in the code, so we don't need to // This is confusing because those files won’t automatically be available in
// additionally serve files by their filenames. Otherwise, even if it // production build folder unless we copy them. However, copying the whole
// works in development, those files will be missing in production, unless // project directory is dangerous because we may expose sensitive files.
// we explicitly copy them. But even if we copy all the files into // Instead, we establish a convention that only files in `public` directory
// the build output (which doesn't seem to be wise because it may contain // get served. Our build script will copy `public` into the `build` folder.
// private information such as files with API keys, for example), we would // In `index.html`, you can get URL of `public` folder with %PUBLIC_PATH%:
// still have a problem. Since the filenames would be the same every time, // <link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">
// browsers would cache their content, and updating file content would not // In JavaScript code, you can access it with `process.env.PUBLIC_URL`.
// work correctly. This is easily solved by importing assets through Webpack // Note that we only recommend to use `public` folder as an escape hatch
// because if it can then append content hashes to filenames in production, // for files like `favicon.ico`, `manifest.json`, and libraries that are
// just like it does for JS and CSS. And because we configured "html" loader // for some reason broken when imported through Webpack. If you just want to
// to be used for HTML files, even <link href="./src/something.png"> would // use an image, put it in `src` and `import` it from JavaScript instead.
// get resolved correctly by Webpack and handled both in development and contentBase: paths.appPublic,
// in production without actually serving it by that path.
contentBase: [],
// Enable hot reloading server. It will provide /sockjs-node/ endpoint // Enable hot reloading server. It will provide /sockjs-node/ endpoint
// for the WebpackDevServer client so it can learn when the files were // for the WebpackDevServer client so it can learn when the files were
// updated. The WebpackDevServer client is included as an entry point // updated. The WebpackDevServer client is included as an entry point
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
*/ */
process.env.NODE_ENV = 'test'; process.env.NODE_ENV = 'test';
process.env.PUBLIC_URL = '';
const createJestConfig = require('./utils/createJestConfig'); const createJestConfig = require('./utils/createJestConfig');
const jest = require('jest'); const jest = require('jest');
......
// @remove-on-eject-begin
/**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
// @remove-on-eject-end
// This Webpack plugin lets us interpolate custom variables into `index.html`.
// Usage: `new InterpolateHtmlPlugin({ 'MY_VARIABLE': 42 })`
// Then, you can use %MY_VARIABLE% in your `index.html`.
// It works in tandem with HtmlWebpackPlugin.
// Learn more about creating plugins like this:
// https://github.com/ampedandwired/html-webpack-plugin#events
'use strict';
class InterpolateHtmlPlugin {
constructor(replacements) {
this.replacements = replacements;
}
apply(compiler) {
compiler.plugin('compilation', compilation => {
compilation.plugin('html-webpack-plugin-before-html-processing',
(data, callback) => {
// Run HTML through a series of user-specified string replacements.
Object.keys(this.replacements).forEach(key => {
const value = this.replacements[key];
data.html = data.html.replace('%' + key + '%', value);
});
callback(null, data);
}
);
});
}
}
module.exports = InterpolateHtmlPlugin;
...@@ -13,14 +13,26 @@ ...@@ -13,14 +13,26 @@
// injected into the application via DefinePlugin in Webpack configuration. // 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');
module.exports = Object function getClientEnvironment(publicUrl) {
.keys(process.env) return Object
.filter(key => REACT_APP.test(key)) .keys(process.env)
.reduce((env, key) => { .filter(key => REACT_APP.test(key))
env['process.env.' + key] = JSON.stringify(process.env[key]); .reduce((env, key) => {
return env; env['process.env.' + key] = JSON.stringify(process.env[key]);
}, { return env;
'process.env.NODE_ENV': NODE_ENV }, {
}); // Useful for determining whether we’re running in production mode.
// Most importantly, it switches React into the correct mode.
'process.env.NODE_ENV': JSON.stringify(
process.env.NODE_ENV || 'development'
),
// Useful for resolving the correct path to static assets in `public`.
// For example, <img src={process.env.PUBLIC_URL + '/img/logo.png'} />.
// This should only be used as an escape hatch. Normally you would put
// images into the `src` and `import` them in code to get their paths.
'process.env.PUBLIC_URL': JSON.stringify(publicUrl)
});
}
module.exports = getClientEnvironment;
...@@ -3,7 +3,16 @@ ...@@ -3,7 +3,16 @@
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="shortcut icon" href="./src/favicon.ico"> <link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">
<!--
Notice the use of %PUBLIC_URL% in the tag above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.
Unlike "/favicon.ico" or "favico.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>React App</title> <title>React App</title>
</head> </head>
<body> <body>
...@@ -15,7 +24,7 @@ ...@@ -15,7 +24,7 @@
You can add webfonts, meta tags, or analytics to this file. You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag. The build step will place the bundled scripts into the <body> tag.
To begin the development, run `npm start` in this folder. To begin the development, run `npm start`.
To create a production bundle, use `npm run build`. To create a production bundle, use `npm run build`.
--> -->
</body> </body>
......
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