首页 > Web开发 > 详细

Webpack Loaders

时间:2017-02-15 10:47:07      阅读:206      评论:0      收藏:0      [点我收藏+]

Webpack Loaders

1、Query parameters

  Loader can be passed query parameters via a query string (just like in the web). The query string is appended to the loader with ?. i.e. url-loader?mimetype=image/png.

  Note: The format of the query string is up to the loader. See format in the loader documentation. Most loaders accept parameters in the normal query format (?key=value&key2=value2) and as JSON object (?{"key":"value","key2":"value2"}).

  1)in require

  技术分享

  2)in configuration

  技术分享

  技术分享

2、webpack analyzes all the node-style require() calls in your app and builds a bundle that you can serve up to the browser using a <script> tag.

  技术分享

3、A loader is a node module exporting a function.

  the loader is called with one parameter: the content of the resource file as string.

  The loader is expected to give back one or two values. The first value is a resulting JavaScript code as string or buffer. The second optional value is a SourceMap as JavaScript object.  

  when multiple loaders are chained, only the last loader gets the resource file and only the first loader is expected to give back one or two values (JavaScript and SourceMap). Values that any other loader give back are passed to the previous loader.

参考:

1、http://webpack.github.io/docs/using-loaders.html

Webpack Loaders

原文:http://www.cnblogs.com/tekkaman/p/6400362.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!