Use webpack@2 RuleSet to match rules
See original GitHub issueDo you want to request a feature, report a bug or ask a question? Bug
What is the current behavior? Loader throws this error:
C:\dev\svg-sprite-loader-bug-repro\node_modules\svg-sprite-loader\lib\utils\get-loader-options.js:25
options = multiRule.map(normalizeRule).find(r => loaderPath.includes(r.loader)).options;
^
TypeError: Cannot read property 'options' of undefined
at getLoaderOptions (C:\dev\svg-sprite-loader-bug-repro\node_modules\svg-sprite-loader\lib\utils\get-loader-options.j
s:25:84)
What is the expected behavior? No error and project to be built
Steps to reproduce:
- clone repo https://github.com/sqal/svg-sprite-loader-bug-repro
npm run build
to see the error
This bug occurrs ONLY in the following setup:
- loader rule is inside of
use
array - use rules.oneOf configuration
- extract option set to true
- plainSprite option set to true
Please tell us about your environment:
- Node.js version: 8.5.0
- webpack version: 3.8.1
- svg-sprite-loader version: 3.4.0
- OS type & version: Windows 10
Issue Analytics
- State:
- Created 6 years ago
- Comments:10 (3 by maintainers)
Top Results From Across the Web
GreenGremlin/webpack-ruleset: A class for working with ...
WebpackRuleset is a slimmed down version of webpack/lib/RuleSet for matching, modifying, and inserting rules in webpack config. Webpack's ...
Read more >Module | webpack - JS.ORG
An array of Rules which are matched to requests when modules are created. These rules can modify how the module is created. They...
Read more >i have this probleme in webpack.config.js
Webpack has been initialised using a configuration object that does not match the API schema. - configuration.module.rules[0] has an unknown ...
Read more >Bud Vue - loader not applying to files outside of the @src
See https://webpack.js.org/concepts#loaders │ > <template> │ | <h1>Gday! ... oneOf: an array of Rules from which only the first matching Rule is used...
Read more >Rulesets
Route events and take action based on predefined event rules. ... This will match events where the severity field does not equal critical...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@kisenka I have the same issue as @raduflp after updating to the 4.1.1. You can use his reproduction to investigate the issue.
Logs:
btw. I noticed that unit test that supposed to test this setup was deleted in this commit, maybe it should be reinstated?
https://github.com/kisenka/svg-sprite-loader/commit/9418920038e72db1b88ab0bd24552420a8a3894d#diff-94ddd23a53d918ba243886e5b60a78afL440
this issue has resurfaced in my case after upgrading from 3.9.x to 4.1.1 my config looks something along the lines
looking at the recent webpack docs examples
{ oneOf: [ /* rules */ ] },
should be a valid rule.@kisenka any thoughts?