Loader定义

建议在loader中指定include

Loader顺序

loaders: ['style', 'css']等价于style(css(input)) 执行是从右往左的,如果是字符串loader之间用!链接

指定Loader参数

字符串形式,在?后面跟上参数

  1. {
  2. test: /\.jsx?$/,
  3. loaders: [
  4. 'babel?cacheDirectory,presets[]=react,presets[]=es2015'
  5. ],
  6. include: PATHS.app
  7. }

或者添加query字段添加

  1. {
  2. test: /\.jsx?$/,
  3. loader: 'babel',
  4. query: {
  5. cacheDirectory: true,
  6. presets: ['react', 'es2015']
  7. },
  8. include: PATHS.app
  9. }

第二种方式每次参数只能应用到一个加载器上,限制了在多加载器上的使用


<<上一节:支持的依赖格式 >>下一节:样式loader