Skip to content
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

fix: enforce esm #546

Merged
merged 1 commit into from
Jun 30, 2020
Merged

Conversation

vankop
Copy link
Contributor

@vankop vankop commented Jun 30, 2020

This PR contains a:

  • bugfix
  • new feature
  • code refactor
  • test update
  • typo fix
  • metadata update

Motivation / Use-Case

Enforce esm for empty module, so webpack can make some optimizations.

Breaking Changes

No

Additional Info

related issue webpack/webpack#10889

@codecov
Copy link

codecov bot commented Jun 30, 2020

Codecov Report

Merging #546 into master will increase coverage by 0.05%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #546      +/-   ##
==========================================
+ Coverage   88.49%   88.55%   +0.05%     
==========================================
  Files           5        5              
  Lines         426      428       +2     
  Branches       94       96       +2     
==========================================
+ Hits          377      379       +2     
  Misses         47       47              
  Partials        2        2              
Impacted Files Coverage Δ
src/loader.js 89.47% <100.00%> (+0.22%) ⬆️

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 6efb133...a365261. Read the comment docs.

Copy link
Member

@alexander-akait alexander-akait left a comment

Choose a reason for hiding this comment

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

Can we add test?

@vankop
Copy link
Contributor Author

vankop commented Jun 30, 2020

we can.. doesn't know what to expect from it since difference would be only in size

@alexander-akait
Copy link
Member

@vankop we can just snapshot module (from stats) result to ensure we output empty module

@@ -6,9 +6,11 @@ import { createFsFromVolume, Volume } from 'memfs';
import MiniCssExtractPlugin from '../../src';

export default (fixture, loaderOptions = {}, config = {}) => {
const { outputFileSystem, ...cnfg } = config;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not related to PR fix, I just wanted to look on output when was testing locally and found a bug with outputFileSystem option..

@vankop
Copy link
Contributor Author

vankop commented Jun 30, 2020

@evilebottnawi damn.. we need upgrade Node.js version to test with webpack@5 ..

@alexander-akait
Copy link
Member

@vankop why? We use 10.13 and above for webpack@5 on CI

@vankop
Copy link
Contributor Author

vankop commented Jun 30, 2020

@evilebottnawi I added webpack@5 (take a look on PR) and it fails with Node.js v8.x in CI

@alexander-akait
Copy link
Member

You don't need to add webpack@5 as dep, it is automated on CI

}
);
const stats = await compile(compiler);
expect(stats.hasErrors()).toBe(false);
Copy link
Member

Choose a reason for hiding this comment

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

export default (name, stats) => {
  const { modules } = stats.toJson({ source: true });
  const module = modules.find((m) => m.name === name);
  let { source } = module;

  return source;
};

Just snapshot module using name

Copy link
Contributor Author

@vankop vankop Jun 30, 2020

Choose a reason for hiding this comment

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

fixed, let me clean up and squash commit..

Copy link
Member

@alexander-akait alexander-akait left a comment

Choose a reason for hiding this comment

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

Can we merge?

@vankop
Copy link
Contributor Author

vankop commented Jun 30, 2020

@evilebottnawi yes, looks good

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

Successfully merging this pull request may close these issues.

2 participants