Merge pull request #8287 from yurydelendik/babel-es2015-preset
Allow to convert (some of) ES6 code to ES5.
This commit is contained in:
commit
fd51a7cb8c
@ -112,7 +112,9 @@ function createWebpackConfig(defines, output) {
|
|||||||
loaders: [
|
loaders: [
|
||||||
{
|
{
|
||||||
loader: 'babel-loader',
|
loader: 'babel-loader',
|
||||||
|
exclude: /src\/core\/(glyphlist|unicode)/, // babel is too slow
|
||||||
options: {
|
options: {
|
||||||
|
presets: bundleDefines.PDFJS_NEXT ? undefined : ['es2015'],
|
||||||
plugins: ['transform-es2015-modules-commonjs']
|
plugins: ['transform-es2015-modules-commonjs']
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -936,9 +938,11 @@ gulp.task('jsdoc', function (done) {
|
|||||||
|
|
||||||
gulp.task('lib', ['buildnumber'], function () {
|
gulp.task('lib', ['buildnumber'], function () {
|
||||||
function preprocess(content) {
|
function preprocess(content) {
|
||||||
|
var noPreset = /\/\*\s*no-babel-preset\s*\*\//.test(content);
|
||||||
content = preprocessor2.preprocessPDFJSCode(ctx, content);
|
content = preprocessor2.preprocessPDFJSCode(ctx, content);
|
||||||
content = babel.transform(content, {
|
content = babel.transform(content, {
|
||||||
sourceType: 'module',
|
sourceType: 'module',
|
||||||
|
presets: noPreset ? undefined : ['es2015'],
|
||||||
plugins: ['transform-es2015-modules-commonjs'],
|
plugins: ['transform-es2015-modules-commonjs'],
|
||||||
}).code;
|
}).code;
|
||||||
var removeCjsSrc =
|
var removeCjsSrc =
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
"babel-core": "^6.23.1",
|
"babel-core": "^6.23.1",
|
||||||
"babel-loader": "^6.4.0",
|
"babel-loader": "^6.4.0",
|
||||||
"babel-plugin-transform-es2015-modules-commonjs": "^6.23.0",
|
"babel-plugin-transform-es2015-modules-commonjs": "^6.23.0",
|
||||||
|
"babel-preset-es2015": "^6.24.1",
|
||||||
"escodegen": "^1.8.0",
|
"escodegen": "^1.8.0",
|
||||||
"eslint": "^3.11.1",
|
"eslint": "^3.11.1",
|
||||||
"gulp": "^3.9.1",
|
"gulp": "^3.9.1",
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
/* no-babel-preset */
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
/* no-babel-preset */
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user