Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@epig/af-build-dev

Package Overview
Dependencies
Maintainers
4
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@epig/af-build-dev

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

  • 1.1.2
  • npm
  • Socket score

Version published
Weekly downloads
27
Maintainers
4
Weekly downloads
 
Created
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 babelTargets = {
    chrome: 49,
    firefox: 64,
    safari: 10,
    edge: 13,
    ios: 10,
    ...(targets || {}),
  };

  const webpackrc = {
    publicPath: '/',
    ignoreMomentLocale: true,
    disableDynamicImport: false,
    hash: isDev ? false : true,
    ...memo, // .webpackrc.js 配置项
    ...rest, // .epigrc.js配置项
    urlLoaderExcludes: [
      /\.(html|ejs|txt)$/,
      ...(memo.urlLoaderExcludes || []),
      ...(rest.urlLoaderExcludes || []),
    ], // 避免url-loader打包html/ejs/txt文件;
    extraBabelPresets: [
      [
        require.resolve('babel-preset-umi'),
        {
          targets: babelTargets,
          env: {
            useBuiltIns: 'entry',
            ...(treeShaking ? { modules: false } : {}),
          },
        },
      ],
      ...(memo.extraBabelPresets || []),
      ...(rest.extraBabelPresets || []),
    ],
    extraBabelPlugins: [
      [require.resolve('babel-plugin-import'), { libraryName: 'antd', style: true }],
      [require.resolve('babel-plugin-import'), { libraryName: 'antd-mobile', style: true }, 'antd-mobile'],
      ...(memo.extraBabelPlugins || []),
      ...(rest.extraBabelPlugins || []),
    ],
  }

.epigrc.js 配置项

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

plugins
  • 类型:Array

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

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

无参数

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

有参数

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

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

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

babel语法兼容配置

// 支持ie11
targets: {
  ie: 11,
}

Keywords

FAQs

Package last updated on 06 Jul 2019

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc