-
Notifications
You must be signed in to change notification settings - Fork 512
refactor: Apply webpack-defaults #542
refactor: Apply webpack-defaults #542
Conversation
- this needs to be rewritten to allow for better assertions
- Convert to ES6+ Class - Convert to ES6+ default export - Convert to const / let - Uses import syntax - Convert errors to templates
- Convert to ES6+ Class - Convert to ES6+ default export - Convert to const / let - Uses import syntax - Convert errors to templates
- Convert to ES6+ Class - Convert to ES6+ default export - Convert to const / let - Uses import syntax - Convert errors to templates
Codecov Report
@@ Coverage Diff @@
## feature/webpack3 #542 +/- ##
===================================================
- Coverage 89.97% 87.37% -2.6%
===================================================
Files 4 7 +3
Lines 349 301 -48
Branches 73 68 -5
===================================================
- Hits 314 263 -51
- Misses 35 36 +1
- Partials 0 2 +2
Continue to review full report at Codecov.
|
ae7168b to
960bc93
Compare
src/index.js
Outdated
| before = [before]; | ||
| } | ||
| options = mergeOptions({ omit: before.length, remove: true }, options); | ||
| delete options.loader; |
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.
I think we can remove it, since it was already deprecated in v2.0.0 (*)
src/index.js
Outdated
| delete options.loader; | ||
| delete options.use; | ||
| delete options.fallback; | ||
| delete options.fallbackLoader; |
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.
*
src/index.js
Outdated
| } else { | ||
| validateOptions(path.resolve(__dirname, './schema/loader.json'), options, 'Extract Text Plugin (Loader)'); | ||
| } | ||
| let loader = options.use || options.loader; |
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.
*
+ options.use
- options.use || options.loader
src/index.js
Outdated
| validateOptions(path.resolve(__dirname, './schema/loader.json'), options, 'Extract Text Plugin (Loader)'); | ||
| } | ||
| let loader = options.use || options.loader; | ||
| let before = options.fallback || options.fallbackLoader || []; |
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.
*
+ options.fallback || []
- options.fallback || options.fallbackLoader || []
src/index.js
Outdated
| ' fallback: string | object | loader[]\n' + | ||
| ' publicPath: string\n'); | ||
| } | ||
| if (options.fallbackLoader) { |
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.
*
- if (options.fallbackLoader) {
- console.warn('fallbackLoader option has been deprecated - replace with "fallback"');
- }
src/index.js
Outdated
| if (options.fallbackLoader) { | ||
| console.warn('fallbackLoader option has been deprecated - replace with "fallback"'); | ||
| } | ||
| if (options.loader) { |
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.
*
- if (options.loader) {
- console.warn('loader option has been deprecated - replace with "use"');
- }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.
Check module.exports. Apart from that looks ok to me.
src/index.js
Outdated
|
|
||
| export default ExtractTextPlugin; | ||
|
|
||
| ExtractTextPlugin.prototype.mergeNonInitialChunks = function (chunk, intoChunk, checkedChunks) { // eslint-disable-line func-names |
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.
Why ain't this methods in the class with class method syntax?
| return source; | ||
| }; | ||
|
|
||
| ExtractTextPlugin.extract = ExtractTextPlugin.prototype.extract.bind(ExtractTextPlugin); |
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 can be a static method. This way it's also correct but difficult to understand
src/lib/helpers.js
Outdated
| } | ||
|
|
||
| export function isFunction(a) { | ||
| return isType('Function', a); |
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.
why not typeof a === "function"?
test/webpack-integration.test.js
Outdated
|
|
||
| describe("TestCases", function() { | ||
| describe("Webpack Integration Tests", function() { | ||
| cases.forEach(function(testCase) { |
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.
spacing in this file is inconsistent
|
Thanks Tobias, I'll get everything updated this evening. |
26c5949 to
9262804
Compare
- refactor: Migrate extracted module to lib - refactor: Migrate order undefined to lib - refactor: Extract etwp helper functions - refactor: Extract compilation to stand alone class - refactor: Proxy plugin module from cjs.js - refactor: Modernize loader syntax - Convert to ES6+ Class - Convert to ES6+ default export - Convert to const / let - Uses import syntax - Convert errors to templates - refactor: Convert tests & configs to import syntax - refactor: Use indexOf in helpers - refactor: Modernize plugin syntax - Convert to ES6+ Class - Convert to ES6+ default export - Convert to const / let - Uses import syntax - Convert errors to templates - refactor: Modernize ExtractedModule syntax - Convert to ES6+ Class - Convert to ES6+ default export - Convert to const / let - Uses import syntax - Convert errors to templates - refactor: Removes fallbackLoader & loader deprecation warnings - refactor: Removes single option deprecation warning - refactor: Removes options.loader & options.fallbackLoader BREAKING CHANGE: Enforces `peerDependencies` of `"webpack": ">= 3.0.0-rc.0 || ^3.0.0"`. BREAKING CHANGE: Enforces `engines` of `"node": ">=4.3.0 < 5.0.0 || >= 5.10`
- refactor: Pass a unique compiler name to get child compilation [483](#483) - refactor: Apply webpack-defaults [542](#542) BREAKING CHANGE: Enforces `engines` of `"node": ">=4.3.0 < 5.0.0 || >= 5.10` - refactor: DeprecationWarning: Chunk.modules [543](#543) BREAKING CHANGE: Updates to `Chunk.mapModules`. This release is not backwards compatible with `Webpack 2.x` due to breaking changes in webpack/webpack#4764 - fix: css generation order issue see: webpack/webpack#5225 BREAKING CHANGE: Enforces `peerDependencies` of `"webpack": "^3.1.0"`.
webpack-defaultstooling updateswebpack-defaultsgrammar updateswebpack-defaultsstyle updatesThe desired effect here is to
updatestyle & grammar without changing the way etwp works.Note, this is being merged into #540 making this refactoring
etwp & webpack v3 onlyCloses #477