From 60a006b1129f7a2db6ebfd9490922d61a353e4af Mon Sep 17 00:00:00 2001 From: SleepWalker Date: Sat, 23 Jul 2016 15:32:48 +0300 Subject: [PATCH] Remove old logic for @import resolving --- webpack-utils/node-sass-iconfont-importer.js | 34 -------------------- webpack.config.js | 8 ----- 2 files changed, 42 deletions(-) delete mode 100644 webpack-utils/node-sass-iconfont-importer.js diff --git a/webpack-utils/node-sass-iconfont-importer.js b/webpack-utils/node-sass-iconfont-importer.js deleted file mode 100644 index abe0722..0000000 --- a/webpack-utils/node-sass-iconfont-importer.js +++ /dev/null @@ -1,34 +0,0 @@ -var loaderUtils = require("loader-utils"); - -module.exports = function createImporter(options) { - return function(url, fileContext, done) { - if (options.test.test(url)) { - var request = loaderUtils.urlToRequest(url); - - loaderContext.loadModule(request, function(err, source) { - if (err) return done(new Error(err)); - - done({ - contents: loaderContext.exec(source) - }); - }); - } else { - done(false); - } - }; -}; - - -var loaderContext; -var Plugin = module.exports.Plugin = function() {}; - -Plugin.prototype.apply = function(compiler) { - compiler.plugin('compilation', function(compilation) { - compilation.plugin('normal-module-loader', setLoaderContext); - }); -}; - -function setLoaderContext(instance) { - // inject loaderContext instance for importer function - loaderContext = instance; -} diff --git a/webpack.config.js b/webpack.config.js index 70bffc5..0171f1a 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -8,7 +8,6 @@ var ExtractTextPlugin = require('extract-text-webpack-plugin'); var HtmlWebpackPlugin = require('html-webpack-plugin'); var cssUrl = require('webpack-utils/cssUrl'); var cssImport = require('postcss-import'); -var iconfontImporter = require('webpack-utils/node-sass-iconfont-importer'); var vendor = Object.keys(require('./package.json').dependencies); @@ -118,7 +117,6 @@ var webpackConfig = { devtool: isTest ? 'inline-source-map' : 'eval', plugins: [ - new iconfontImporter.Plugin(), new webpack.DefinePlugin({ 'process.env': { NODE_ENV: JSON.stringify(process.env.NODE_ENV) @@ -202,12 +200,6 @@ var webpackConfig = { } }, - sassLoader: { - importer: iconfontImporter({ - test: /\.font.(js|json)$/ - }) - }, - postcss() { return [ cssImport({