pieroxy / lz-string

LZ-based compression algorithm for JavaScript
MIT License
4.08k stars 567 forks source link

lz-string@2.0.0-rc.3 build with warnings #237

Closed Georg-Git closed 5 months ago

Georg-Git commented 5 months ago

I suceed in building only when vitest installing with parameter --force due to dependency problems:

vitest:
npm WARN using --force Recommended protections disabled.
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: vitest@1.4.0
npm WARN Found: @vitest/ui@1.2.2
npm WARN node_modules/@vitest/ui
npm WARN   dev @vitest/ui@"1.2.2" from the root project
npm WARN
npm WARN Could not resolve dependency:
npm WARN peerOptional @vitest/ui@"1.4.0" from vitest@1.4.0
npm WARN node_modules/vitest
npm WARN   dev vitest@"1.4.0" from the root project
npm WARN   2 more (@vitest/coverage-v8, @vitest/ui)
npm WARN
npm WARN Conflicting peer dependency: @vitest/ui@1.4.0
npm WARN node_modules/@vitest/ui
npm WARN   peerOptional @vitest/ui@"1.4.0" from vitest@1.4.0
npm WARN   node_modules/vitest
npm WARN     dev vitest@"1.4.0" from the root project
npm WARN     2 more (@vitest/coverage-v8, @vitest/ui)

Nevertheless the outcomes seems to be ok!

Build on latest windows 11 with latest npm 10.5.0

Georg-Git commented 5 months ago

Solved.

Maybe a few tips on building would be helpful:

git clone https://github.com/pieroxy/lz-string.git
npm install eslint -D
npm install prettier -D
npm install vite -D
npm install vitest -D
npm run build
dist/index.umd.js  6.08 kB │ gzip: 1.94 kB │ map: 39.92 kB
✓ built in 2.78s
karnthis commented 5 months ago

All you should need to do is

git clone
npm i
npm run build
Georg-Git commented 5 months ago

embarrassing.... 😉

To give this issue a justification for existence - one warning is left:

...
dist/_compress.js                                              2.65 kB │ gzip: 0.64 kB │ map: 14.06 kB

No name was provided for external module "fs" in "output.globals" – guessing "fs".
Creating a browser bundle that depends on Node.js built-in modules ("fs"). You might need to include https://github.com/FredKSchott/rollup-plugin-polyfill-node

dist/index.umd.js  6.08 kB │ gzip: 1.94 kB │ map: 39.92 kB
✓ built in 2.81s
Rycochet commented 5 months ago

Nobody should use npm i unless they're actively developing and updating dependencies - it should be npm ci which ensures everything is the same versions (ie, be deterministic). That warning is ok, the code it warns about is for use in nodejs only, but we're building a bundle that can be used in both nodejs and the browser 😄