🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

webpackrc-cfg

Package Overview
Dependencies
Maintainers
1
Versions
102
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

webpackrc-cfg

## webpack 配置项

latest
npmnpm
Version
1.2.0
Version published
Weekly downloads
9
-91.82%
Maintainers
1
Weekly downloads
 
Created
Source

webpackrc-cfg

webpack 配置项

选项意义默认值
mode模式,区分生产环境还是开发环境,可选值为 'production' 或 'development''production'
template模板所在文件夹,默认扫描源目录undefined
entry入口文件,默认扫描源目录中的 jstsx? 文件
output出口undefined
publicPath设置 output.publicPathundefined
resolve解析规则undefined
alias别名,默认扫描源目录下的文件夹undefined
devtoolsourcemap 生成规则,'development' 默认下默认 'source-map'undefined
externals外部扩展undefined
target构建目标undefined
rules额外的加载器undefined
module内置加载器选项配置undefined
splitChunksOptions公共模块抽取,自动提取到 commons 文件内undefined
compress是否压缩true
enableCssModules是否开启 css modulesfalse

上下文

选项意义默认值
npm所使用的包管理器名'npm'
cwdcwd,默认 process.cwd()process.cwd()
paths工程目录相关见示例
entry入口文件,默认扫描源目录中的 jstsx? 文件

示例

import { getWebpackConfig } from 'webpackrc-cfg';

const webpackConfig = getWebpackConfig({
  mode: 'production',// 值为 'production' 或 'development',默认 'production'
  template: '../examples',// 模板所在文件夹
  entry: { index: 'src/index.js' },// 入口文件,默认扫描源目录下的 js 文件获得
  output: { path },// 出口
  publicPath: './',// output.publicPath
  resolve: {},// 解析
  alias: { components: 'src/components' },// 别名,默认扫描源目录下的文件夹
  devtool: 'source-map',// 'development' 下默认 'source-map'
  externals: { react: 'React' },// 外部扩展
  target: 'node',// 构建目标
  rules: [{ test: /\.vue$/, loader: 'vue-loader' }],// 额外的加载器
  module: {
    eslint: {},// 开启 eslint 校验
    babel: { plugins, presets },// 定义额外 babel 的配置
    ts: {  },// 定义额外 ts 的配置
    css: { modules: false },// 定义额外 css 的配置
  },
  splitChunksOptions: {// 公共模块抽取,自动提取到 commons 文件内
    minSize: 1000
  },
  compress: false// 是否压缩
}, {
  npm: 'cnpm',// 依赖安装命令
  cwd: 'workspace',// 工作目录,默认 process.cwd()
  paths: {
    src: 'src',// 源目录,默认 'src' 目录
    dist: 'dist',// 目标目录,默认 'dist' 目录
    assets: 'assets',// 静态资源,默认 'assets' 目录
    nodeModules: 'node_modules'// 依赖目录,默认 'node_modules' 目录
  }
});

FAQs

Package last updated on 18 Aug 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