From d28d2f9f8d7e3d92776a7ed7a38b724bb63eec02 Mon Sep 17 00:00:00 2001 From: joriewong Date: Tue, 21 Feb 2017 16:08:27 +0800 Subject: [PATCH 1/5] Update configuration.md --- content/configuration.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/configuration.md b/content/configuration.md index 6d35903..767f142 100644 --- a/content/configuration.md +++ b/content/configuration.md @@ -47,7 +47,7 @@ module.exports = { }, module: { loaders: [ - {test: /\.css$/, loader: 'style!css'} + {test: /\.css$/, loader: 'style-loader!css-loader'} ] } } From d3c65468a8ac2d20dc2064470d5341adbedc32cc Mon Sep 17 00:00:00 2001 From: joriewong Date: Tue, 21 Feb 2017 16:11:07 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E6=96=B0=E7=89=88=E6=9C=ACcss=20loader=20b?= =?UTF-8?q?ugfix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- content/configuration.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/configuration.md b/content/configuration.md index 767f142..bb25108 100644 --- a/content/configuration.md +++ b/content/configuration.md @@ -47,7 +47,7 @@ module.exports = { }, module: { loaders: [ - {test: /\.css$/, loader: 'style-loader!css-loader'} +      {test: /\.css$/, loader: 'style-loader!css-loader'} ] } } From 662b7d8cca03d4e1f6cea7774cff178aa67696ff Mon Sep 17 00:00:00 2001 From: joriewong Date: Tue, 21 Feb 2017 16:12:46 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E6=96=B0=E7=89=88css=20loader=20bugfix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- content/loader.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/content/loader.md b/content/loader.md index a3ac569..05fa927 100644 --- a/content/loader.md +++ b/content/loader.md @@ -38,7 +38,7 @@ body { background: yellow; } 修改 entry.js: ```js -require("!style!css!./style.css") // 载入 style.css +require("!style-loader!css-loader!./style.css") // 载入 style.css document.write('It works.') document.write(require('./module.js')) ``` @@ -56,10 +56,10 @@ npm install css-loader style-loader 将 entry.js 中的 `require("!style!css!./style.css")` 修改为 `require("./style.css")` ,然后执行: ```bash -$ webpack entry.js bundle.js --module-bind 'css=style!css' +$ webpack entry.js bundle.js --module-bind 'css=style-loader!css-loader' # 有些环境下可能需要使用双引号 -$ webpack entry.js bundle.js --module-bind "css=style!css" +$ webpack entry.js bundle.js --module-bind "css=style-loader!css-loader" ``` 显然,这两种使用 loader 的方式,效果是一样的。 From aa26d6770649ce9ec8fed01e0366bd735993aece Mon Sep 17 00:00:00 2001 From: joriewong Date: Tue, 21 Feb 2017 16:18:31 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E6=96=B0=E7=89=88=E6=9C=ACcss=20loader=20b?= =?UTF-8?q?ugfix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- content/configuration.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/configuration.md b/content/configuration.md index bb25108..aaf3cbc 100644 --- a/content/configuration.md +++ b/content/configuration.md @@ -59,4 +59,4 @@ module.exports = { require('./style.css') ``` -最后运行 `webpack`,可以看到 webpack 通过配置文件执行的结果和上一章节通过命令行 `webpack entry.js bundle.js --module-bind 'css=style!css'` 执行的结果是一样的。 +最后运行 `webpack`,可以看到 webpack 通过配置文件执行的结果和上一章节通过命令行 `webpack entry.js bundle.js --module-bind 'css=style-loader!css-loader'` 执行的结果是一样的。 From 005a1150d30244b3f6e92b57d16a73b4a01f0ead Mon Sep 17 00:00:00 2001 From: joriewong Date: Tue, 21 Feb 2017 16:19:05 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E6=96=B0=E7=89=88=E6=9C=ACcss=20loader=20b?= =?UTF-8?q?ugfix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- content/plugin.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/content/plugin.md b/content/plugin.md index cd881ca..5146f90 100644 --- a/content/plugin.md +++ b/content/plugin.md @@ -21,7 +21,7 @@ module.exports = { }, module: { loaders: [ - {test: /\.css$/, loader: 'style!css'} + {test: /\.css$/, loader: 'style-loader!css-loader'} ] }, plugins: [ @@ -38,4 +38,4 @@ module.exports = { /******/ // The module cache /******/ var installedModules = {}; // 后面代码省略 -``` \ No newline at end of file +```