mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-08 09:20:06 +02:00
Upgrade to Webpack 4
This commit is contained in:
parent
e3f635ce01
commit
a816ee5c25
6 changed files with 23 additions and 22 deletions
|
@ -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.
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
})
|
||||
]
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue