与Gulp,Rollup,Babel不完整的Sourcemap

时间:2017-05-23 19:14:55

标签: gulp babel source-maps rollupjs

我无法使用此Gulp配置获取好的源图。

gulp.task('scripts', () => {
  return gulp.src('app/scripts/**/*.js')
    .pipe($.plumber())
    .pipe($.sourcemaps.init())
    .pipe(
        $.rollup(
            {               
                plugins: [
                    babel(
                        {
                            babelrc: false,
                            presets: ["es2015-rollup"],
                            exclude: 'node_modules/**',
                            plugins: [
                                  ["transform-react-jsx", {
                                       "pragma": "m"
                                  }]
                            ]
                        }
                    )
                ],
                entry: './app/scripts/main.js'
            }
        )
    )
    .pipe($.sourcemaps.write('.'))
    .pipe(gulp.dest('.tmp/scripts'))
    .pipe(reload({stream: true}));
});

main.js是一个导入本地文件的简单脚本

'use strict';

import Application from './framework/Application.js';

code...

但我得到的源图是:

{"version":3,"file":"main.js","sources":[],"sourcesContent":[],"names":[],"mappings":";<  ... many ';' here ... >;"}

安装Npm开发包

"babel-core": "^6.4.0",
"babel-plugin-external-helpers": "^6.22.0",
"babel-plugin-transform-react-jsx": "^6.24.1",
"babel-preset-es2015": "^6.3.13",
"babel-preset-es2015-rollup": "^3.0.0",
"babel-register": "^6.5.2",
"browser-sync": "^2.2.1",
"del": "^2.2.0",
"gulp": "^3.9.0",
"gulp-autoprefixer": "^3.0.1",
"gulp-babel": "^6.1.1",
"gulp-cache": "^0.4.2",
"gulp-cssnano": "^2.0.0",
"gulp-eslint": "^3.0.0",
"gulp-filter": "^4.0.0",
"gulp-htmlmin": "^3.0.0",
"gulp-if": "^2.0.2",
"gulp-imagemin": "^3.0.1",
"gulp-load-plugins": "^1.2.4",
"gulp-plumber": "^1.0.1",
"gulp-rollup": "^2.11.0",
"gulp-sass": "^2.0.0",
"gulp-size": "^2.1.0",
"gulp-sourcemaps": "^2.2.0",
"gulp-uglify": "^2.0.0",
"gulp-useref": "^3.0.0",
"main-bower-files": "^2.5.0",
"rollup-plugin-babel": "^2.7.1",
"rollup-plugin-commonjs": "^8.0.2",
"rollup-plugin-node-resolve": "^3.0.0",
"run-sequence": "^1.2.2",
"wiredep": "^4.0.0"

有什么想法吗?

0 个答案:

没有答案