在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 問答/HTML5  HTML/ webpack使用css-loader時(shí)為什么不需要引入?

webpack使用css-loader時(shí)為什么不需要引入?

module.exports = {
  module: {
    rules: [
      {
        test: /\.css$/,
        use: [ 'style-loader', 'css-loader' ]
      }
    ]
  }
}

在webpack的配置文件中 直接就是用了css-loader
而沒有使用require或者import去引入
這是為什么呢?

回答
編輯回答
離殤

Referencing loaders By convention, though not required, loaders are
usually named as XXX-loader, where XXX is the context name. For
example, json-loader.

You may reference loaders by its full (actual) name (e.g.
json-loader), or by its shorthand name (e.g. json).

The loader name convention and precedence search order is defined by
resolveLoader.moduleTemplates within the webpack configuration API.

Loader name conventions may be useful, especially when referencing
them within require() statements; see usage below.

方檔里有解釋啊

2017年9月19日 11:36
編輯回答
逗婦乳

loader 和你的 import xxx 不是一個(gè)東西。

loader實(shí)際上是webpack本身會(huì)去調(diào)用或者應(yīng)用的函數(shù)而已,本質(zhì)上,webpack 調(diào)用loader的方法是 loader-runner 也就是說,當(dāng)你在webpack中配置了loader之后,它自身會(huì)在需要的地方加載你的loader,加載的方式就是:https://github.com/webpack/lo...

看你說沒有啥文檔,在loader-api里面就有說明:

2017年1月29日 07:21
編輯回答
咕嚕嚕

你并沒有直接用啊,你只是告訴webpack要用這個(gè)東西,怎么用是它的機(jī)制。

2018年3月19日 23:08