Skip to content
Permalink
Browse files
fix bug with incorrectly emitted modules
  • Loading branch information
sokra committed May 27, 2018
1 parent 7ebe12d commit ae8d6741d7b363266c437b924349358e64bc13f1
Show file tree
Hide file tree
Showing 9 changed files with 54 additions and 1 deletion.
@@ -107,7 +107,10 @@ class SideEffectsFlagPlugin {
const map = pair[1];
for (const reason of module.reasons) {
const dep = reason.dependency;
if (dep instanceof HarmonyImportSpecifierDependency) {
if (
dep instanceof HarmonyImportSpecifierDependency &&
!dep.namespaceObjectAsContext
) {
const mapping = map.get(dep.id);
if (mapping) {
dep.redirectedModule = mapping.module;
@@ -2062,6 +2062,25 @@ Child
ModuleConcatenation bailout: Module is referenced from these modules with unsupported syntax: ./first.js (referenced with import())"
`;

exports[`StatsTestCases should print correct stats for side-effects-simple-unused 1`] = `
"Hash: 0cb74fac5f3c1b7f2150
Time: Xms
Built at: Thu Jan 01 1970 00:00:00 GMT
Asset Size Chunks Chunk Names
main.js 2.94 KiB 0 [emitted] main
Entrypoint main = main.js
[0] ./node_modules/pmodule/b.js 69 bytes [built]
[no exports used]
[1] ./node_modules/pmodule/a.js 60 bytes [built]
[no exports used]
[2] ./index.js + 2 modules 158 bytes {0} [built]
| ./index.js 55 bytes [built]
| ./node_modules/pmodule/index.js 75 bytes [built]
| [only some exports used: default]
| ./node_modules/pmodule/c.js 28 bytes [built]
| [only some exports used: z]"
`;

exports[`StatsTestCases should print correct stats for simple 1`] = `
"Hash: 1843cc9aed8366594774
Time: Xms
@@ -0,0 +1,3 @@
import def, { z } from "pmodule";

console.log(def, z);

Some generated files are not rendered by default. Learn more.

Some generated files are not rendered by default. Learn more.

Some generated files are not rendered by default. Learn more.

Some generated files are not rendered by default. Learn more.

Some generated files are not rendered by default. Learn more.

@@ -0,0 +1,8 @@
module.exports = {
mode: "production",
entry: "./index",
stats: {
nestedModules: true,
usedExports: true
}
};

0 comments on commit ae8d674

Please sign in to comment.