External Library using Rollup.JS with Formik doesn't respect named exports
You are probably thinking no one on planet earth will ever have the same obscure error. You would be wrong. Found the solution. (It was related to order on the plugins)
plugins: [
globals(),
builtins(),
externals(),
babel({ exclude: 'node_modules/**', presets: ['@babel/env', '@babel/preset-react'] }),
commonjs({
namedExports: {
// left-hand side can be an absolute path, a path
// relative to the current directory, or the name
// of a module in node_modules
'node_modules/formik/node_modules/scheduler/index.js' : ['unstable_runWithPriority'],
}
}),
peerDepsExternal(),
postcss({ extract: true, plugins: [autoprefixer] }),
json({ include: 'node_modules/**' }),
localResolve(),
resolve({dedupe: [ 'react', 'react-dom' ]}),
filesize()
]