Skip to content
This repository has been archived by the owner on May 29, 2019. It is now read-only.

feat: add option to merge files (options.merge) #636

Closed
wants to merge 7 commits into from

Conversation

danikaze
Copy link

Implements #634

Current status: it's merging files properly but the map file is lost in the intermediate step.

source1 --> file1.css + map1
source2 --> file2.css + map2 --> mergedFile (no map)
source3 --> file3.css + map3

@jsf-clabot
Copy link

jsf-clabot commented Sep 29, 2017

CLA assistant check
All committers have signed the CLA.

@codecov
Copy link

codecov bot commented Sep 29, 2017

Codecov Report

Merging #636 into master will increase coverage by 0.53%.
The diff coverage is 93.93%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #636      +/-   ##
==========================================
+ Coverage   87.41%   87.95%   +0.53%     
==========================================
  Files           7        7              
  Lines         302      332      +30     
  Branches       68       73       +5     
==========================================
+ Hits          264      292      +28     
- Misses         36       38       +2     
  Partials        2        2
Impacted Files Coverage Δ
src/index.js 90.36% <93.93%> (+0.65%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8de6558...cccabaa. Read the comment docs.

@michael-ciniawsky michael-ciniawsky changed the title implementation of options.merge (#634) feat: add option to merge files (options.merge) Sep 29, 2017
@michael-ciniawsky michael-ciniawsky added this to the 3.1.0 milestone Sep 29, 2017
Copy link
Member

@michael-ciniawsky michael-ciniawsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thx the logic looks good so far, but needs tests an interface design triage

package.json Outdated
@@ -1,6 +1,6 @@
{
"name": "extract-text-webpack-plugin",
"version": "3.0.0",
"version": "3.1.0",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please revert this as we have release management in place and will take care of that

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

understood

src/index.js Outdated
this.filesToMerge[mergeChunk.filename] = [];
}
this.filesToMerge[mergeChunk.filename].push(extractedChunk);
preventOutput = preventOutput || (mergeChunk.preventOriginalOutput !== false);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we find a better name (less verbose) then preventOriginalOutput => prevent || original || preventOriginal || ? ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure, I was thinking also about that :P

I will include the tests, but wanted to make sure it wasn't going to become a dropped feature :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😛 Well we definitely need to check for ordering issues && multi entry setups and it needs approval from other maintainers aswell. But the feature itself is a nice improvement imho

…ons.merge[].originals

* Revert version number to 3.0.0 due to internal management

* Renamed options.merge[].preventOriginalOutput to a shorter options.merge[].originals

* Test added but breaking lol. Need to check generated file names

* Added test, but can't debug it

* Need to check merge.originals option

* options.merge[].originals working now
@danikaze
Copy link
Author

danikaze commented Oct 2, 2017

Hello. It looks like test is passing now.
But it took me some time so I want to comment about the environment:

  • jest is buggy. It doesn't allow any console.log to be printed. It's a known bug. Any workaround?
  • Tests were running and passing in local environment, but not in appveyor.
  • It's hard to debug because the running setup doesn't allow for breakpoints (or not easily) + no console.log = impossible to follow while running.

So, after just checking the logic, I made it work.
But travis is failing because of this

ERROR: npm is known not to run on Node.js v4.3.2
Node.js 4 is supported but the specific version you're running has
a bug known to break npm. Please update to at least ${rel.min} to use this
version of npm. You can find the latest release of Node.js at https://nodejs.org/

Anything to do?

@michael-ciniawsky
Copy link
Member

jest is buggy. It doesn't allow any console.log to be printed. It's a known bug. Any workaround?

Could you post the e.g tracking issue or elaborate where/what isn't going to work? I use console.logwith Jest on a regular basis and never have had any issue, but the ETWP code base might be different here :)

Does npm t -- --verbose work at least?

Tests were running and passing in local environment, but not in appveyor

I will take a look later

But travis is failing because of this

Ignore this for now as it is unrelated to ETWP or this PR in particular (it's a known npm issue with node =< v4.5.0)

@danikaze
Copy link
Author

danikaze commented Oct 2, 2017

jest bug: jestjs/jest#2166
It's not important, but when things doesn't work, it's hard to debug.

appveyor is passing now (after the last commit) so it should be ready to merge if we ignore the npm 4.3 issue in travis.
The main problem is, I was having a false positive in my local environment, don't know why because breakpoints weren't working.

Copy link
Member

@joshwiens joshwiens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I want @sokra's take on this before it goes anywhere. Given this ( etwp ) is going away & being rolled back into Webpack, any feature added is one that has to be ported into Webpack.

My initial impression is conceptually, this is a bit murky, hard to sufficiently test & I guarantee people are going to have trouble with it. That said, if Tobias is okay with it conceptually then we can work through the implementation .

@joshwiens
Copy link
Member

@danikaze - We are going to have to pass on this one. Even if there wasn't already a plugin published for this, the last thing etwp needs at this point is more complexity.

This is already planned for retirement & the functionality rolled back into Webpack where it belongs, this particular use case may or may not be addressed at that time, it's not for me to say.

@danikaze
Copy link
Author

danikaze commented Oct 3, 2017

I see. Bad luck then.
I thought after finding lot of people looking for this feature and an outdated plugin, that would be nice to have this in the core of the plugin, but I see what you mean.
I´ll try to move the logic then to yet another plugin, though it would be harder to generate map files in a complete different step, I think.

@joshwiens
Copy link
Member

@danikaze - If you feel there is enough demand for this particular plugin, we can discuss rolling it as a stand alone in contrib.

Given the state of etwp, where it's going & the similarities with the allChunks setting this isn't the right place for it.

@danikaze
Copy link
Author

danikaze commented Oct 4, 2017

@d3viant0ne sure.
Thanks for your time taking a look anyways ;)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants