Upgrade to Webpack 4

This commit is contained in:
Tim van der Meij 2018-05-20 15:18:43 +02:00
parent e3f635ce01
commit a816ee5c25
No known key found for this signature in database
GPG key ID: 8C3FD2925A5F2762
6 changed files with 23 additions and 22 deletions

View file

@ -4,16 +4,16 @@ Example to demonstrate PDF.js library usage with Webpack.
## Getting started
Build project and install the example dependencies:
Install the example dependencies and build the project:
$ gulp dist-install
$ cd examples/webpack
$ npm install
$ ./node_modules/webpack/bin/webpack.js
To build Webpack bundles, run `node_modules/.bin/webpack`. If you are running
a web server, you can observe the build results at
http://localhost:8888/examples/webpack/index.html
You can observe the build results by running `gulp server` and navigating to
http://localhost:8888/examples/webpack/index.html.
See main.js and webpack.config.js files. Please notice that PDF.js
packaging requires packaging of the main application and PDF.js worker code,
and the `workerSrc` path shall be set to the latter file.
Refer to the `main.js` and `webpack.config.js` files for the source code.
Note that PDF.js packaging requires packaging of the main application and
the worker code, and the `workerSrc` path shall be set to the latter file.

View file

@ -5,7 +5,8 @@
"build": "webpack"
},
"devDependencies": {
"webpack": "~1.12.9",
"webpack": "^4.10.2",
"webpack-cli": "^2.1.4",
"pdfjs-dist": "../../node_modules/pdfjs-dist"
}
}

View file

@ -7,17 +7,10 @@ module.exports = {
'main': './main.js',
'pdf.worker': 'pdfjs-dist/build/pdf.worker.entry'
},
mode: 'none',
output: {
path: path.join(__dirname, '../../build/webpack'),
publicPath: '../../build/webpack/',
filename: '[name].bundle.js'
},
plugins: [
new webpack.optimize.UglifyJsPlugin({
compressor: {
screw_ie8: true,
warnings: false
}
})
]
}
};