From 5921b157c575ce087ca2203a06174eaf5c79efd3 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 5514610f..2562bbc9 100644 --- a/index.js +++ b/index.js @@ -1063,6 +1063,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). *