-
Notifications
You must be signed in to change notification settings - Fork 23
/
main.js
81 lines (68 loc) · 1.44 KB
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
// two is not used. Using two should throw.
import { one } from "dep";
// A default export
import anon from "dep/another";
// A package not using sideEffects: false
import { one as twoOne } from "dep2";
// A built-in module that should be ignored.
import steal from "@steal";
// Importing a module for its side effects
import "dep3";
// CSS
import "./styles.css";
// Importing a module that itself should be tree-shaken
import {default as dep4} from "dep4";
// Importing a module that re-exports another
import { rexpOne } from "./reexports";
// Import a CommonJS module
import dep5 from "dep5";
// Import a package but only use some subpackages
import { DefineMap } from "can";
export default function(){
window.globals = {
one,
anon,
twoOne,
steal,
rexpOne,
dep4,
dep5,
DefineMap
};
let shouldFail = steal.import("can-connect@1.0.0#main").then(null, function(err){
err.didFail = true;
return err;
});
// return all of the exports so the tests can assert things.
let p = Promise.all([
steal.import("~/bundle-a"),
steal.import("dep"),
steal.import("dep2"),
steal.import("dep4/other"),
steal.import("dep4/and-another"),
steal.import("~/from-exports"),
shouldFail
]);
return p
.then(([
bundleA,
dep,
depTwo,
dep4Other,
dep4AndAnother,
fromExports,
canConnect
]) => {
return {
anon,
bundleA,
dep,
depTwo,
dep4Other,
dep4AndAnother,
fromExports,
dep5,
canConnect
};
});
};