-
Notifications
You must be signed in to change notification settings - Fork 496
Use ESM build in modern browser (<script type="module" ...>) #631
Copy link
Copy link
Closed
Labels
kind: featureNew feature or requestNew feature or requestsolution: intended behaviorThis is not a bug and is expected behaviorThis is not a bug and is expected behaviorsolution: unresolvedIssue has been closed by OP but root cause has not necessarily been resolvedIssue has been closed by OP but root cause has not necessarily been resolvedsolution: workaround availableThere is a workaround available for this issueThere is a workaround available for this issue
Description
Metadata
Metadata
Assignees
Labels
kind: featureNew feature or requestNew feature or requestsolution: intended behaviorThis is not a bug and is expected behaviorThis is not a bug and is expected behaviorsolution: unresolvedIssue has been closed by OP but root cause has not necessarily been resolvedIssue has been closed by OP but root cause has not necessarily been resolvedsolution: workaround availableThere is a workaround available for this issueThere is a workaround available for this issue
Current Behavior
babel-plugin-dev-expressionreplaces all instances of__DEV__withprocess.env.NODE_ENV !== 'production'. As the process variable may not be available outside of nodejs, it introduces an incompatibility with modern browsers.Suggested solution(s)
There are several different ways we could approach fixing this:
tsdx.config.jsthat allows users to opt out ofbabel-plugin-dev-expression, or replace with a different plugin.babel-plugin-dev-expressionwith another plugin that works in both browser and nodejs environments. I made a quick fork of babel-plugin-dev-expression that does just that.Additional context
Affects these issues:
immer
an open issue in
babel-plugin-dev-expression