Skip to content

Commit f4c9324

Browse files
authored
Merge pull request #38 from blocknative/fix/module-context
Add module context to rollup config
2 parents 0c37b09 + 8a80c76 commit f4c9324

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

rollup.config.js

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,17 @@ export default [
3232
babel({ exclude: "node_modules/**" }),
3333
builtins(),
3434
terser()
35-
]
35+
],
36+
moduleContext: id => {
37+
const thisAsWindowForModules = [
38+
"node_modules/intl-messageformat/lib/core.js",
39+
"node_modules/intl-messageformat/lib/compiler.js"
40+
]
41+
42+
if (thisAsWindowForModules.some(id_ => id.trimRight().endsWith(id_))) {
43+
return "window"
44+
}
45+
}
3646
},
3747
{
3848
input: "src/index.js",
@@ -56,6 +66,16 @@ export default [
5666
commonjs(),
5767
babel({ exclude: "node_modules/**" })
5868
],
69+
moduleContext: id => {
70+
const thisAsWindowForModules = [
71+
"node_modules/intl-messageformat/lib/core.js",
72+
"node_modules/intl-messageformat/lib/compiler.js"
73+
]
74+
75+
if (thisAsWindowForModules.some(id_ => id.trimRight().endsWith(id_))) {
76+
return "window"
77+
}
78+
},
5979
output: [
6080
{
6181
dir: "dist/esm",

0 commit comments

Comments
 (0)