commit
3c51f2fc1a
1
.gitignore
vendored
1
.gitignore
vendored
@ -7,4 +7,3 @@ Makefile
|
||||
node_modules/
|
||||
examples/node/svgdump/
|
||||
examples/node/pdf2png/*.png
|
||||
package-lock.json
|
||||
|
@ -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
|
||||
}
|
||||
})
|
||||
]
|
||||
}
|
||||
};
|
||||
|
2
external/webpack/pdfjsdev-loader.js
vendored
2
external/webpack/pdfjsdev-loader.js
vendored
@ -27,7 +27,7 @@ module.exports = function (source) {
|
||||
this.cacheable();
|
||||
|
||||
var filePath = this.resourcePath;
|
||||
var context = this.options.context;
|
||||
var context = this.rootContext;
|
||||
var sourcePath = path.relative(context, filePath).split(path.sep).join('/');
|
||||
|
||||
var ctx = Object.create(this.query);
|
||||
|
13
gulpfile.js
13
gulpfile.js
@ -146,8 +146,15 @@ function createWebpackConfig(defines, output) {
|
||||
var skipBabel = bundleDefines.SKIP_BABEL ||
|
||||
process.env['SKIP_BABEL'] === 'true';
|
||||
|
||||
// Required to expose e.g., the `window` object.
|
||||
output.globalObject = 'this';
|
||||
|
||||
return {
|
||||
mode: 'none',
|
||||
output: output,
|
||||
performance: {
|
||||
hints: false, // Disable messages about larger file sizes.
|
||||
},
|
||||
plugins: [
|
||||
new webpack2.BannerPlugin({ banner: licenseHeaderLibre, raw: true, }),
|
||||
],
|
||||
@ -160,7 +167,7 @@ function createWebpackConfig(defines, output) {
|
||||
},
|
||||
devtool: enableSourceMaps ? 'source-map' : undefined,
|
||||
module: {
|
||||
loaders: [
|
||||
rules: [
|
||||
{
|
||||
loader: 'babel-loader',
|
||||
// babel is too slow
|
||||
@ -1166,10 +1173,10 @@ gulp.task('dist-pre', ['generic', 'components', 'lib', 'minified'], function() {
|
||||
license: DIST_LICENSE,
|
||||
dependencies: {
|
||||
'node-ensure': '^0.0.0', // shim for node for require.ensure
|
||||
'worker-loader': '^1.1.1', // used in external/dist/webpack.json
|
||||
'worker-loader': '^2.0.0', // used in external/dist/webpack.json
|
||||
},
|
||||
peerDependencies: {
|
||||
'webpack': '^2.0.0 || ^3.0.0', // peerDependency of 'worker-loader'
|
||||
'webpack': '^3.0.0 || ^4.0.0-alpha.0 || ^4.0.0', // from 'worker-loader'
|
||||
},
|
||||
browser: {
|
||||
'fs': false,
|
||||
|
13699
package-lock.json
generated
Normal file
13699
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
26
package.json
26
package.json
@ -2,22 +2,22 @@
|
||||
"name": "pdf.js",
|
||||
"version": "2.0.0",
|
||||
"devDependencies": {
|
||||
"acorn": "^5.5.3",
|
||||
"autoprefixer": "^8.2.0",
|
||||
"babel-core": "^6.26.0",
|
||||
"acorn": "^5.6.1",
|
||||
"autoprefixer": "^8.6.0",
|
||||
"babel-core": "^6.26.3",
|
||||
"babel-loader": "^7.1.4",
|
||||
"babel-plugin-transform-es2015-modules-commonjs": "^6.26.0",
|
||||
"babel-preset-env": "^1.6.1",
|
||||
"core-js": "^2.5.4",
|
||||
"babel-plugin-transform-es2015-modules-commonjs": "^6.26.2",
|
||||
"babel-preset-env": "^1.7.0",
|
||||
"core-js": "^2.5.7",
|
||||
"escodegen": "^1.9.1",
|
||||
"eslint": "^4.19.1",
|
||||
"eslint-plugin-mozilla": "^0.10.0",
|
||||
"eslint-plugin-no-unsanitized": "^3.0.0",
|
||||
"eslint-plugin-mozilla": "^0.13.0",
|
||||
"eslint-plugin-no-unsanitized": "^3.0.2",
|
||||
"fancy-log": "^1.3.2",
|
||||
"gulp": "^3.9.1",
|
||||
"gulp-postcss": "^7.0.1",
|
||||
"gulp-rename": "^1.2.2",
|
||||
"gulp-replace": "^0.6.1",
|
||||
"gulp-rename": "^1.2.3",
|
||||
"gulp-replace": "^1.0.0",
|
||||
"gulp-transform": "^3.0.5",
|
||||
"gulp-zip": "^4.1.0",
|
||||
"jasmine": "^3.1.0",
|
||||
@ -28,14 +28,14 @@
|
||||
"node-ensure": "^0.0.0",
|
||||
"rimraf": "^2.6.2",
|
||||
"streamqueue": "^1.1.2",
|
||||
"systemjs": "0.21.0",
|
||||
"systemjs": "^0.21.4",
|
||||
"systemjs-plugin-babel": "^0.0.25",
|
||||
"ttest": "^1.1.0",
|
||||
"typogr": "^0.6.7",
|
||||
"uglify-es": "^3.3.9",
|
||||
"vinyl": "^2.1.0",
|
||||
"vinyl-fs": "^3.0.2",
|
||||
"webpack": "^3.11.0",
|
||||
"vinyl-fs": "^3.0.3",
|
||||
"webpack": "^4.10.2",
|
||||
"webpack-stream": "^4.0.3",
|
||||
"wintersmith": "^2.4.1",
|
||||
"yargs": "^11.0.0"
|
||||
|
Loading…
x
Reference in New Issue
Block a user