diff --git a/gulpfile.js b/gulpfile.js index 522081fef..fce122e4e 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -112,7 +112,9 @@ function createWebpackConfig(defines, output) { loaders: [ { loader: 'babel-loader', + exclude: /src\/core\/(glyphlist|unicode)/, // babel is too slow options: { + presets: bundleDefines.PDFJS_NEXT ? undefined : ['es2015'], plugins: ['transform-es2015-modules-commonjs'] } }, @@ -936,9 +938,11 @@ gulp.task('jsdoc', function (done) { gulp.task('lib', ['buildnumber'], function () { function preprocess(content) { + var noPreset = /\/\*\s*no-babel-preset\s*\*\//.test(content); content = preprocessor2.preprocessPDFJSCode(ctx, content); content = babel.transform(content, { sourceType: 'module', + presets: noPreset ? undefined : ['es2015'], plugins: ['transform-es2015-modules-commonjs'], }).code; var removeCjsSrc = diff --git a/package.json b/package.json index 190d398e4..5483db852 100644 --- a/package.json +++ b/package.json @@ -6,6 +6,7 @@ "babel-core": "^6.23.1", "babel-loader": "^6.4.0", "babel-plugin-transform-es2015-modules-commonjs": "^6.23.0", + "babel-preset-es2015": "^6.24.1", "escodegen": "^1.8.0", "eslint": "^3.11.1", "gulp": "^3.9.1", diff --git a/src/core/glyphlist.js b/src/core/glyphlist.js index 060ed8f9b..52b24f13e 100644 --- a/src/core/glyphlist.js +++ b/src/core/glyphlist.js @@ -12,6 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +/* no-babel-preset */ 'use strict'; diff --git a/src/core/unicode.js b/src/core/unicode.js index 71ee710a6..610e62730 100644 --- a/src/core/unicode.js +++ b/src/core/unicode.js @@ -12,6 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +/* no-babel-preset */ 'use strict';