遇到的問題:我用gulp-webpack工具來執(zhí)行webpack任務(wù)。發(fā)現(xiàn)打包后的文件中的 “import $ from 'jquery'”都還保留著(css文件已經(jīng)被編譯進去了),文件也很小,只有幾百行,然而我單獨在終端執(zhí)行“webpack”,文件是可以被正確編譯的,有上萬行。請問大家,這是怎么回事?怎么解決?謝謝~下面是我的相關(guān)代碼:webpack.config.jsgulpfile.jsvar gulp = require('gulp');var plugins = require('gulp-load-plugins')();var webpack = require('gulp-webpack');var webpackConf = require('./webpack.config.js');gulp.task('webpack', function () { return gulp.src(globs.js) .pipe(webpack(webpackConf)) .pipe(gulp.dest("build/js"));});
單獨執(zhí)行webpack和使用gulp-webpack打包的文件結(jié)果不一樣。
瀟湘沐
2018-10-09 13:19:20