Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Aug 8, 2019. It is now read-only.
/docsPublic archive

multiple entry points

Sujal Patel edited this pageJul 8, 2017 ·8 revisions

Prerequirement:Code Splitting

If you need multiple bundles for multiple HTML pages you can use the "multiple entry points" feature. It will build multiple bundles at once. Additional chunks can be shared between these entry chunks and modules are only built once.

Hint: When you want to start an entry chunk from a module, you are doing something wrong. UseCode Splitting instead!

Every entry chunk contains the webpack runtime, so you can only load one entry chunk per page. (Hint: To bypass this limitation use the CommonsChunkPlugin to move the runtime into a single chunk.)

Configuration

To use multiple entry points you can pass an object to theentry option. Each value is treated as an entry point and the key represents the name of the entry point.

When using multiple entry points you must override the defaultoutput.filename option. Otherwise each entry point would write to the same output file. Use[name] to get the name of the entry point.

Minimal example configuration

{entry:{a:"./a",b:"./b",c:["./c","./d"]},output:{path:path.join(__dirname,"dist"),filename:"[name].entry.js"}}

Examples1

webpack 👍

Clone this wiki locally

[8]ページ先頭

©2009-2025 Movatter.jp