Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

请问书上第23页里面的那个loaders是怎么个用法 #7

Closed
zshawk1992 opened this issue Jan 3, 2018 · 6 comments
Closed

请问书上第23页里面的那个loaders是怎么个用法 #7

zshawk1992 opened this issue Jan 3, 2018 · 6 comments

Comments

@zshawk1992
Copy link

zshawk1992 commented Jan 3, 2018

module: {
    rules: [
      {
        // 用正则去匹配要用该 loader 转换的 CSS 文件
        test: /\.css$/,
        **loaders**: ExtractTextPlugin.extract({
          // 转换 .css 文件需要使用的 Loader
          use: ['css-loader'],
        }),
      }
    ]
  }

里面这个loaders跟之前的use是什么关系,有的时候你用use,有时候又是loaders,书里并没有说明这个loaders

@gwuhaolin
Copy link
Owner

gwuhaolin commented Jan 4, 2018

Webpack 官方推荐全部使用 use,使用 useloaders 效果一样,loaders是老版本的做法,Webpack3开始使用 use
下一版本我会把 loaders 全部换成 use

@qiqingfu
Copy link

我在这里老是报错 说 extract-text-webpack-plugin 和我的webpack版本对不上。我的是 3.x的版本呀

@chengwenxin
Copy link

的是 3

执行 npm install -D extract-text-webpack-plugin@next 命令
将其更新到extract-text-webpack-plugin4.0.0-beta.0

@qiqingfu
Copy link

@chengwenxin 我的 webpack 是 3.11.0的版本

@chengwenxin
Copy link

@chengwenxin 我的 webpack 是 3.11.0的版本

噢,抱歉,我一直用的是webpack4,先入为主了。只能等待其他大佬给你解答了

@qiqingfu
Copy link

@chengwenxin 多谢了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants