1.0.0-beta.1 • Published 4 years ago
webpack-default-entry v1.0.0-beta.1
webpack-default-entry
According to a series of default rules, return the list of available entry files
Installation
Use the package manager npm to install webpack-default-entry.
npm install webpack-default-entry
Usage
import getDefaultEntryFile webpack-default-entry
const entryFiles=getDefaultEntryFile()
Options
You can pass a hash of configuration options to getEntryFile
.
Allowed values are as follows
Name | Type | Default | Description |
---|---|---|---|
cwd | {String} | process.cwd() | The current working directory in which to search |
pages | {{Array.<{entry:string, template?:string,template?:string, title?:string, chunks?:string}>}} | [{entry:'src/index.js',template:'public/index.html'}] | An object that specifies its entry, template, filename, title and chunks (all optional except entry). Any other properties added beside those will also be passed directly to html-webpack-plugin, allowing user to customize said plugin;具体可参考 |
Default Query rules
Query file suffix
is [js,ts,jsx,tsx,vue]
1. Get the pages field configured in package.json
in the directory,
Not found, go to the next step
2. Treat as single page mode by default, find src/index${suffix}
,go to the next step
3. Treat as multi-page mode,Find all sub-directory information under the pages directory, such as src/pages/home/(home|index).${suffix}
Remarks Query file default suffix
is js,ts,jsx,tsx,vue