ReferenceError when using an AtlasKit Field component

Hi guys,

I’ve just hit the same issue after upgrading to Webpack 5.
And then there’s another package @atlaskit/analytics-next that requires process.env.ANALYTICS_NEXT_MODERN_CONTEXT. So my first approach was the same as suggested by @candid with DefinePlugin, but later I found another solution which returns the process polyfill back:

a) add process dependency: npm i --save-dev process
b) add to webpack config

plugins: [
        new webpack.ProvidePlugin({
                // required by some @atlaskit components, but Webpack5 does not provide node.js polyfills anymore
                process: 'process/browser',
        }),
    ],

Just wanted to share. Hope it’ll help somebody not to waste a couple of hours like I did.

-Alex

2 Likes