Skip to content

feat(webpack): add support for multiple entrypoints#130

Merged
Heymdall merged 5 commits intomasterfrom
feat/multiple-entry
Aug 19, 2020
Merged

feat(webpack): add support for multiple entrypoints#130
Heymdall merged 5 commits intomasterfrom
feat/multiple-entry

Conversation

@Heymdall
Copy link
Member

Добавлена поддержка любых возможных конфигураций entryPoint, как серверной, так и клиентской.
Теперь через настройки в package.json можно передавать строку, массив, или объект с entryPoint

Так же, читаются настройки jest (см. [документацию](https://facebook.github.io/jest/docs/en/configuration.html))
и `proxy` (см. [документацию](https://github.com/facebook/create-react-app/blob/master/packages/react-scripts/template/README.md#proxying-api-requests-in-development)).

Несколько entry point
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Похоже нужно накинуть тестов

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

к сожалению пока в это репе с тестами плохо. Я делаю в другой ветке рефакторинг с вынесением интеграционных тестов в отдельный пакет, там можно будет сделать несколько вариантов конфигураций базовых. Пока так оставлю

if (Array.isArray(entryPoint)) {
return getSingleEntry(entryPoint);
}
// client entry also can be an object, so we must add hot loader to each entry point
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

такое чувство что копипаста


function getSingleEntry(clientEntry) {
return [
configs.clientPolyfillsEntry,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

возможно это не очень хорошо, так как энтрипоинты могут требовать разных полифилов

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

в таком случае можно просто общие полифилы в null или false задать. А полифилы на каждый entry уже задавать через конфигурацию этих самых entry. Тип "clientEntry": { "mobile": ["src/mobile-polyfills", "src/mobile"] }.
В общем же случае мне кажется разумным таки их сразу подключать. Вообще вполне возможно получится избавиться от ручных полифилов после мержа вот этого

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

да, согласен. А разве


не испортит все?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Heymdall если ломаться не будет то ок

@Heymdall Heymdall merged commit 18ddc33 into master Aug 19, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants