notwaldorf / example-magenta-in-ts

A demo of using @magenta/music as a dev-dependency in a TypeScript project
Other
21 stars 6 forks source link

Excluding TensorFlow from bundle #6

Open cifkao opened 4 years ago

cifkao commented 4 years ago

The size of the produced bundle is 2 MB. By importing just @magenta/music/es6/core, I'm able to cut this down to 1.4 MB, but out of that almost 1MB is still TensorFlow. Any idea why it is being included when core doesn't seem to depend on it? How can I get rid of it?

notwaldorf commented 4 years ago

Hmm, I wonder if some webpack gymnastics need to be done here: https://github.com/notwaldorf/example-magenta-in-ts/blob/master/webpack.config.js#L10

cifkao commented 4 years ago

This is weird, I thought core does not depend on TensorFlow because I can use core.js from jsDelivr without it and it does not complain. But apparently it does depend on it:

image

https://github.com/magenta/magenta-js/blob/b149ce62e7b58075e7177d3b33be123fb6706144/music/src/core/data.ts#L26