-
-
Notifications
You must be signed in to change notification settings - Fork 198
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow to add custom loaders #11
Changes from 1 commit
b21f7aa
e078772
0ea9d74
539fd11
d6a1bc0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,6 +49,7 @@ class WebpackConfig { | |
this.providedVariables = {}; | ||
this.babelConfigurationCallback = function() {}; | ||
this.useReact = false; | ||
this.loaders = new Set(); | ||
} | ||
|
||
getContext() { | ||
|
@@ -157,6 +158,10 @@ class WebpackConfig { | |
this.styleEntries.set(name, src); | ||
} | ||
|
||
addLoader(test, use, options = { include: null, exclude: null }) { | ||
this.loaders.add({ 'test': test, 'use': use, 'include': options.include || null, 'exclude': options.exclude || null }); | ||
} | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We need to expose this in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks, don't know how I missed this :) Functions added |
||
enableVersioning(enabled = true) { | ||
this.useVersioning = enabled; | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -235,6 +235,12 @@ class ConfigGenerator { | |
}); | ||
} | ||
|
||
if (this.webpackConfig.loaders.size > 0) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no need for this check. |
||
this.webpackConfig.loaders.forEach((loader) => { | ||
rules.push(loader); | ||
}); | ||
} | ||
|
||
return rules; | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does not need to be a Set. It could just be an array.
You create a new object inside
addLoader
, so the uniqueness check of the Set will never exclude anything anyway. You're just using it as an array here