Large webpack bundle
See original GitHub issueWhen I import PDFJS through webpack the bundlesize is significatly larger than the minified pdf.min.js file provided in pdfjs-dist. pdf.min.js: 299KB webpack bundle: 988KB
my entry file looks like this:
import { PDFJS, getDocument } from 'pdfjs-dist'
or
import { PDFJS } from 'pdfjs-dist/lib/display/global';
import { getDocument } from 'pdfjs-dist/lib/display/api';
webpack 3 config:
const webpack = require('webpack');
const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
module.exports = {
entry: {
'pdf.js': './example/pdf-js.entry.js'
},
output: {
path: __dirname + '/example/dist',
filename: '[name].bundle.js'
},
plugins: [
new webpack.optimize.ModuleConcatenationPlugin(),
new UglifyJSPlugin({
parallel: true,
extractComments: true,
uglifyOptions: {
output: {
comments: false,
beautify: false,
},
compress: {
sequences: false
}
}
}),
new webpack.optimize.LimitChunkCountPlugin({
maxChunks: 1,
minChunkSize: 1000
})
],
};
Is there a way to get to the same bundle size as pdf.min.js? Are there plans to make pdf.js treeshakable?
Thanks!
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Webpack final bundle size is too big - node.js - Stack Overflow
I know I am missing something here. Should be somewhere near to or more than webpack recommendations but 1010 KB is too much....
Read more >3 ways to reduce webpack bundle size - Jakob Lind
Go through these three steps to get a quick overview of what to do to reduce webpack bundle size. I have listed them...
Read more >How to Reduce Your Webpack Bundle Size for Web App ...
So I'm gonna try to give you some tips used by teams working on large apps to reduce the size of their main...
Read more >5 Methods to Reduce JavaScript Bundle Size - Bits and Pieces
1. Code Splitting with Webpack. Code splitting allows you to separate your code into bundles and load them on-demand. There are multiple ways ......
Read more >How to put your Webpack bundle on a diet - Contentful
Webpack is a static module bundler for JavaScript applications. While it's very useful, Webpack can sometimes create unnecessarily large bundles ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Try Adobe Embed APIs: https://www.adobe.com/devnet-docs/dcsdk_io/viewSDK/index.html
But the minified files from pdfjs-dist are much smaller. Don’t they include the same library? I now include those minified files as script tags in my html instead of bundling them with webpack, and my application runs the same.