json-diff icon indicating copy to clipboard operation
json-diff copied to clipboard

1.0.3 breaks webpack build

Open lzilioli-prism opened this issue 1 year ago • 0 comments

The patch notes for 1.0.3 state 1.0.3 Change from cli-color to colors to reduce package size.

I am currently trying to upgrade my project from 1.0.0 to 1.0.6 and encountering the following error with my angular/webpack build:

./node_modules/colors/lib/system/supports-colors.js:28:9-22 - Error: Module not found: Error: Can't resolve 'os' in '/Users/lzilioli/Projects/prism-frontend/node_modules/colors/lib/system'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
	- add a fallback 'resolve.fallback: { "os": require.resolve("os-browserify/browser") }'
	- install 'os-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
	resolve.fallback: { "os": false }

Is there a good way to resolve this? Arguably, the change in 1.0.3 should have come as a major version bump, since this change effectively breaks support for browsers.

lzilioli-prism avatar Apr 24 '24 00:04 lzilioli-prism