Closed ashubham closed 4 years ago
hey @ashubham Check the UMD config for the setup required.
@gilbarbara I am not using the UMD bundle, I am using rollup to bundle the application as an es
target. Use of global
keyword inside ES modules is non standard, which is throwing errors.
Hi! I see that you've already closed this @gilbarbara but I'm running into the same issue.
My rollup config is set to es
format but receiving errors around using global
. Do you have any suggestions to resolve this?
If it narrows the problem space any, I'm not experiencing this problem when building on macOS but I am experiencing it on Ubuntu 18.0.4 LTS
@dustinknopoff I used this workaround, basically create a rollup plugin like this:
export function patchReactFloater() {
return {
name: 'patch-react-floater',
transform(code, id) {
if(id.endsWith('react-floater/es/index.js')) {
return `var global = typeof self !== undefined ? self : this;\n${code}`
}
}
}
}
Then use it in the plugins of your rollup config.
🐛 Bug Report
When I am trying to use the
es
build of the library with Rollup, I see this error:This is related to the issue I am seeing: https://github.com/gilbarbara/react-floater/pull/59
To Reproduce
Use the library with rollup, with target
es
.Expected behavior
global
is not in the ES6 spec and should not be implicitly assumed to have a value. Maybe have something likevar global = typeof self !== undefined ? self : this;
on top of the module.