# webpack-get-pages-config

> 根据pages目录自动生成pages配置

Latest version **1.0.0** (published 2020-05-04) · ISC license · 0 weekly downloads

## Install

```sh
npm install webpack-get-pages-config
pnpm add webpack-get-pages-config
yarn add webpack-get-pages-config
bun add webpack-get-pages-config
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2020-05-04 |
| First published | 2020-04-20 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 10.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | linxuekai |
| Maintainers | linxuekai |
| Keywords | webpack, multi pages |

## Links

- npm: https://www.npmjs.com/package/webpack-get-pages-config
- npm.io page: https://npm.io/package/webpack-get-pages-config

## Alternatives

- [raw-loader](https://npm.io/package/raw-loader.md) — 4.3M weekly downloads
- [plop](https://npm.io/package/plop.md) — 1.4M weekly downloads
- [webpack-deadcode-plugin](https://npm.io/package/webpack-deadcode-plugin.md) — 80.3K weekly downloads
- [@storybook/preact-vite](https://npm.io/package/@storybook/preact-vite.md) — 54.2K weekly downloads
- [vite-plugin-transform](https://npm.io/package/vite-plugin-transform.md) — 2.4K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2020-05-04
- 0.1.5 — 2020-05-04
- 0.1.4 — 2020-05-04
- 0.1.3 — 2020-05-04
- 0.1.2 — 2020-05-04
- 0.1.1 — 2020-05-04
- 0.1.0 — 2020-05-04
- 0.0.3 — 2020-04-21
- 0.0.2 — 2020-04-20
- 0.0.1 — 2020-04-20

## README

``` 
// vue project directory structure

src
├── pages
│   ├── pageA
│   │   ├── index.vue
│   │   └── main.js
│   ├── pageB
│   └── pageC
├── components
├── ...
```



`hasPrivateHtmlTemplate` means `${pageDirPath}/index.html` file exist. This file will be the template html for the page.

`hasPrivatePageConf` means `${pageDirPath}/page.config.js` commondjs mode file exist which `module.exports` is a `PageConfig` type data, and this config data will merge to the default config data generated, by using `Object.asign()` method.

```js
// The generated pages data, example for pageA

pageDirPath = 'absolute_path_to_src/pages/pageA'
pageName = 'pageA'

pageAConfig = {
  pageA: {
    entry: `${pageDirPath}/main.js`,
    template: hasPrivateHtmlTemplate
      ? `${pageDirPath}/index.html`
      : path_resolve('public/index.html'),
    filename: `${pageName}.html`,
    title: pageName,
    chunks: ['chunk-vendors', 'chunk-common', pageName]
  }
}

// The pageConfig data for others page is the same as pageAConfig
```

## Usage

```js
// vue.config.js

const pages = requrie('webpack-get-pages-config')

module.exports = {
  pages
}
```

---
_Source: https://npm.io/package/webpack-get-pages-config · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
