Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Webpack to the latest stable version (4.29.6) #10599

Merged
merged 2 commits into from
Feb 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 1 addition & 28 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,21 +150,6 @@ function createWebpackConfig(defines, output) {
var skipBabel = bundleDefines.SKIP_BABEL ||
process.env['SKIP_BABEL'] === 'true';

// TODO: Remove this hack once the Webpack regression has been fixed; see
// https://github.com/mozilla/pdf.js/issues/10177
function babelPluginReplaceNonWebPackRequire(babel) {
return {
visitor: {
Identifier(path, state) {
if (path.node.name === '__non_webpack_require__') {
path.replaceWith(
babel.types.identifier('TEMPORARY_NON_WEBPACK_REQUIRE_HACK'));
}
},
},
};
}

// Required to expose e.g., the `window` object.
output.globalObject = 'this';

Expand Down Expand Up @@ -199,7 +184,6 @@ function createWebpackConfig(defines, output) {
'helpers': false,
'regenerator': true,
}],
babelPluginReplaceNonWebPackRequire, // Temporary hack.
],
},
},
Expand Down Expand Up @@ -264,12 +248,6 @@ function replaceWebpackRequire() {
return replace('__webpack_require__', '__w_pdfjs_require__');
}

function replaceTemporaryNonWebpackRequireHack() {
// TODO: Remove this hack once the Webpack regression has been fixed; see
// https://github.com/mozilla/pdf.js/issues/10177
return replace('TEMPORARY_NON_WEBPACK_REQUIRE_HACK', 'require');
}

function replaceJSRootName(amdName, jsName) {
// Saving old-style JS module name.
return replace('root["' + amdName + '"] = factory()',
Expand All @@ -292,7 +270,6 @@ function createBundle(defines) {
var mainOutput = gulp.src('./src/pdf.js')
.pipe(webpack2Stream(mainFileConfig))
.pipe(replaceWebpackRequire())
.pipe(replaceTemporaryNonWebpackRequireHack()) // Temporary hack.
.pipe(replaceJSRootName(mainAMDName, 'pdfjsLib'));

var workerAMDName = 'pdfjs-dist/build/pdf.worker';
Expand All @@ -308,7 +285,6 @@ function createBundle(defines) {
var workerOutput = gulp.src('./src/pdf.worker.js')
.pipe(webpack2Stream(workerFileConfig))
.pipe(replaceWebpackRequire())
.pipe(replaceTemporaryNonWebpackRequireHack()) // Temporary hack.
.pipe(replaceJSRootName(workerAMDName, 'pdfjsWorker'));
return merge([mainOutput, workerOutput]);
}
Expand All @@ -320,8 +296,7 @@ function createWebBundle(defines) {
filename: viewerOutputName,
});
return gulp.src('./web/viewer.js')
.pipe(webpack2Stream(viewerFileConfig))
.pipe(replaceTemporaryNonWebpackRequireHack()); // Temporary hack.
.pipe(webpack2Stream(viewerFileConfig));
}

function createComponentsBundle(defines) {
Expand All @@ -337,7 +312,6 @@ function createComponentsBundle(defines) {
return gulp.src('./web/pdf_viewer.component.js')
.pipe(webpack2Stream(componentsFileConfig))
.pipe(replaceWebpackRequire())
.pipe(replaceTemporaryNonWebpackRequireHack()) // Temporary hack.
.pipe(replaceJSRootName(componentsAMDName, 'pdfjsViewer'));
}

Expand All @@ -354,7 +328,6 @@ function createImageDecodersBundle(defines) {
return gulp.src('./src/pdf.image_decoders.js')
.pipe(webpack2Stream(componentsFileConfig))
.pipe(replaceWebpackRequire())
.pipe(replaceTemporaryNonWebpackRequireHack()) // Temporary hack.
.pipe(replaceJSRootName(imageDecodersAMDName, 'pdfjsImageDecoders'));
}

Expand Down
206 changes: 103 additions & 103 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading