From 01880cf6b07f84d06106df8480cc32ebdc23a3db Mon Sep 17 00:00:00 2001 From: Hugo Alliaume Date: Sat, 2 Feb 2019 08:25:00 +0100 Subject: [PATCH] Add method on "Encore" --- index.js | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/index.js b/index.js index f0325126..74328532 100644 --- a/index.js +++ b/index.js @@ -1100,6 +1100,32 @@ class Encore { return this; } + /** + * Configure Webpack loaders rules (`module.rules`). + * This is a low-level function, be careful when using it. + * + * https://webpack.js.org/concepts/loaders/#configuration + * + * For example, if you are using Vue and ESLint loader, + * this is how you can configure ESLint to lint Vue files: + * + * Encore + * .enableEslintLoader() + * .enableVueLoader() + * .configureLoaderRule('eslint', (loader) => { + * loader.test = /\.(jsx?|vue)/; + * }); + * + * @param {string} name + * @param {function} callback + * @return {Encore} + */ + configureLoaderRule(name, callback) { + webpackConfig.configureLoaderRule(name, callback); + + return this; + } + /** * If enabled, the output directory is emptied between each build (to remove old files). *