gbv / jskos-tools

Tools for working with the JSKOS data format.
https://gbv.github.io/jskos-tools/
MIT License
2 stars 0 forks source link

Make available via bundle #19

Closed stefandesu closed 4 years ago

stefandesu commented 5 years ago

To directly use with a script tag.

nichtich commented 5 years ago

Would make sense for a demo HTML page where people can edit, validate, and convert JSKOS in the browser. Related resources:

Anyway, this is a larger issue

stefandesu commented 4 years ago

We should also pay attention to the bundle size. We are using a subset of the Lodash library, but according to BundlePhobia, it adds a whopping 33 kB to our bundle size.

nichtich commented 4 years ago

I started with rollup, see https://github.com/gbv/jskos-tools/tree/rollup but stuck

stefandesu commented 4 years ago

I completed the Rollup configuration, but still need to test if it actually worked as intended.

stefandesu commented 4 years ago

It seems to work now, but Terser (the tool I used for minification) shows all kinds of warnings and it feels like something is broken:

index.js → dist/jskos-tools.umd.js...                                                                                                                                                               
babelHelpers: 'bundled' option was used by default. It is recommended to configure this option explicitly, read more here: https://github.com/rollup/plugins/tree/master/packages/babel#babelhelpers
(!) Plugin terser: Dropping duplicated definition of variable desc [0:313,8]                                                                                                                        
rollupPluginBabelHelpers.js                                                                                                                                                                         
(!) Plugin terser: Condition left of && always true [0:7,20]                                                                                                                                        
node_modules/lodash/_cloneBuffer.js                                                                                                                                                                 
node_modules/lodash/_nodeUtil.js                                                                                                                                                                    
(!) Plugin terser: Dropping side-effect-free && [0:10,19]                                                                                                                                           
node_modules/lodash/_cloneBuffer.js                                                                                                                                                                 
node_modules/lodash/_nodeUtil.js                                                                                                                                                                    
(!) Plugin terser: Condition left of && always true [0:8,20]                                                                                                                                        
node_modules/lodash/isBuffer.js                                                                                                                                                                     
(!) Plugin terser: Dropping side-effect-free && [0:11,19]                                                                                                                                           
node_modules/lodash/isBuffer.js                                                                                                                                                                     
(!) Plugin terser: Dropping unreachable code [0:45,2]                                                                                                                                               
node_modules/lodash/_baseIsNative.js                  
(!) Plugin terser: Declarations in unreachable code! [0:45,2]
node_modules/lodash/_baseIsNative.js
created dist/jskos-tools.umd.js in 4.2s
stefandesu commented 4 years ago

I removed minification because jsDelivr has it built-in.