mattermost / mattermost-plugin-legal-hold

Plugin to create and manage legal holds in Mattermost
Other
5 stars 2 forks source link

Fix process.env frontend issue #48

Closed mickmister closed 2 months ago

mickmister commented 2 months ago

Summary

When the plugin's webapp bundle is loaded in the frontend, we hit this error that makes the plugin fail to load. Some libraries expect process.env.NODE_ENV to be available during runtime. By default, attempting to access this property results in a null pointer because process is not normally defined in the context of the browser.

This PR configures a webpack plugin that fills in the process.env.NODE_ENV variable in the bundle, to match the value at compilation time. See more here https://stackoverflow.com/a/64553486