Skip to content
This repository was archived by the owner on Apr 4, 2019. It is now read-only.

Commit 9aa3481

Browse files
committed
simply support for webpack2
1 parent b63e72e commit 9aa3481

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

example/webpack.config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ module.exports = {
1818
}),
1919
new InlineResourcePlugin({
2020
compile: true,
21-
compress: false,
21+
compress: true,
2222
rootpath: './src',
2323
template: './src/hello.html',
2424
test: /^hello\.html$/
@@ -31,7 +31,7 @@ module.exports = {
3131
}),
3232
new InlineResourcePlugin({
3333
compile: true,
34-
compress: false,
34+
compress: true,
3535
rootpath: './src',
3636
template: './src/world.html',
3737
test: /^world\.html$/

index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ InlineResourcePlugin.prototype.generateUniqueFileName = function (path) {
4141
* @returns {*}
4242
*/
4343
InlineResourcePlugin.prototype.initLoader = function (template, compiler) {
44-
var moduleConfig = _.extend({preLoaders: [], loaders: [], postLoaders: []}, compiler.options.module);
44+
//'rules' option is support for webpack2
45+
var moduleConfig = _.extend({preLoaders: [], loaders: [], postLoaders: [], rules: []}, compiler.options.module);
4546
var loaders = moduleConfig.preLoaders.concat(moduleConfig.loaders).concat(moduleConfig.postLoaders);
4647
loaders.forEach(function (loader) {
4748
if (loader.test.test(template)) {

0 commit comments

Comments
 (0)