cloudflare / workers-webpack-example

An example of building a Cloudflare Worker with Webpack
33 stars 13 forks source link

workers.api.error.script_too_large #5

Open alnimra opened 5 years ago

alnimra commented 5 years ago

Hey,

When I run webpack with minimization on production mode, it still says it's too big. @zackbloom do you have any advice?

webpack.config.js

  module.exports = {
    entry: "./src/all.js",
    mode: "production",
    optimization: {
      minimize: true
    },
    performance: {
      hints: false
    },
    output: {
      path: __dirname + "/dist",
      publicPath: "dist",
      filename: "worker.js"
    }
  };
zackbloom commented 5 years ago

Hi!

Do you have very large dependencies being installed? Maybe it's possible to use tree-shaking to remove some of them?

Zack

-- Zack Bloom

On Fri, Feb 22, 2019 at 4:47 PM, Alnim < notifications@github.com > wrote:

Hey,

When I run webpack with minimization on production mode, it still says it's too big. @ zackbloom ( https://github.com/zackbloom ) do you have any advice?

webpack.config.js

module. exports = { entry : "./src/all.js " , mode : " production " , optimization : { minimize : true }, performance : { hints : false }, output : { path : __dirname + " /dist " , publicPath : " dist " , filename : " worker.js " } };

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub ( https://github.com/cloudflare/workers-webpack-example/issues/5 ) , or mute the thread ( https://github.com/notifications/unsubscribe-auth/AADYM_7cPSiMFzg_e36Ozh89wIfUWAy_ks5vQI-vgaJpZM4bNJ3n ).

alnimra commented 5 years ago

Thank for replying so quick!

I'm was actually just running the project from this repo. With the exact same settings, the only difference is that the optimization's minimize is true.

Thanks, Milan

zackbloom commented 5 years ago

So minimization true made it larger?!

-- Zack Bloom

On Tue, Feb 26, 2019 at 5:03 PM, Alnim < notifications@github.com > wrote:

Thank for replying so quick!

I'm was actually just running the project from this repo. With the exact same settings, the only difference is that the optimization's minimize is true.

Thanks, Milan

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub ( https://github.com/cloudflare/workers-webpack-example/issues/5#issuecomment-467680307 ) , or mute the thread ( https://github.com/notifications/unsubscribe-auth/AADYMw6w5B4lStUKU96j0h00N-RoVGHxks5vRdlagaJpZM4bNJ3n ).

Wundark commented 5 years ago

Looks like the moment-timezone dependency contains a data JSON file that is 900KB. 95750C41-D28F-4CA5-B08A-6A307198FA3D

sgammon commented 3 years ago

@zackbloom we're hitting this with a production WASM module now. is ~3mb really too big?