Socket
Socket
Sign inDemoInstall

@epig/af-build-dev

Package Overview
Dependencies
5
Maintainers
3
Versions
27
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @epig/af-build-dev

基于af-webpack的前端构建编译工具


Version published
Maintainers
3
Created

Readme

Source

af-build-dev

基于af-webpack的前端构建编译工具

usage

安装

$ npm i @epig/af-build-dev --save-dev

cli

$ epig dev # 启动开发服务器
$ epig build # 构建项目

配置项

环境变量

只列部分,详细参考af-webpack源码;

NAMENOTESDEFAULT_VALUE
PROT服务器端口8000
ANALYZEwebpack-bundle-analyzer插件开关undefined
SPEED_MEASUREspeed-measure-webpack-plugin插件开关undefined
.webpackrc.js 配置项

参考af-webpack中的webpack配置项

由于af-build-dev内建chainConfig支持,请不要配置chainConfig,其他配置项和合并到内置配置项。

内置配置项

  const webpackrc = {
    ...memo, // .webpackrc.js 配置项
    ...rest, // .epigrc.js配置项
    publicPath: '/',
    ignoreMomentLocale: true,
    disableDynamicImport: false,
    urlLoaderExcludes: [/\.(html|ejs)$/], // 避免url-loader打包html/ejs文件;
    hash: isDev ? false : true,
    extraBabelPlugins: [
      [require.resolve('@babel/plugin-syntax-dynamic-import')],
      [require.resolve('babel-plugin-import'), { libraryName: 'antd', style: true }],
      [require.resolve('babel-plugin-import'), { libraryName: 'antd-mobile', style: true }, 'antd-mobile'],
      ...(memo.extraBabelPlugins || []),
    ],
  }
.epigrc.js 配置项

在此配置文件中也可以配置 .webpackrc.js 的同名配置项,会合并使用(优先级:.epigrc.js>.webpackrc.js), 但是配置在此的配置项不会进行检查。

plugins
  • 类型:Array

数组项支持为插件名字或者自定义方法。

如果插件有参数,则通过数组的形式进行配置,第一项是插件名字,第二项是参数,类似 babel 插件的配置方式。

无参数

  plugins: [
    ['epig-plugin-admin'],
  ],

有参数

  plugins: [
    ['epig-plugin-admin', {router: true}],
  ],
chainWebpack

可支持链式配置webpack配置,参考webpack-chain

chainWebpack(config, { webpack }) {
  // 设置 alias
  config.resolve.alias.set('a', 'path/to/a');
}
 

plugins

内置插件

const builtInPlugins = [
  'afwebpack-config',
  'epig-plugin-mock',
];

afwebpack-config

内置自定义webpack配置项

epig-plugin-mock

mock功能

epig-plugin-admin

管理后台

  • 类型: Object
NAMENOTESTYPEDEFAULT_VALUE
noAutoEntry禁止自动生成入口booleanundefined
noAutoRoute禁止自动生成路由booleanundefined
noAutoModel禁止自动生成modelbooleanundefined
async-booleanundefined

epig-plugin-html

配置HTML模板

  • 类型: Array | Object

参考html-webpack-plugin配置项

epig-plugin-copy-server

拷贝项目根目录的server文件夹

  • 类型: Object
NAMENOTESTYPEDEFAULT_VALUE
output输出目录string同webpack.output.path

epig-plugin-hd

配置移动端的高清方案

NAMENOTESTYPEDEFAULT_VALUE
themeless变量Object{}
px2rempx2rem配置项Object{}

Keywords

FAQs

Last updated on 01 Mar 2019

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc