@@ -9,7 +9,8 @@ const fs = require('fs');
9
9
10
10
const Config = require ( './Config.js' ) ;
11
11
const Manager = require ( '../modules/manager.js' ) ;
12
- const ExtractTextPlugin = require ( 'extract-text-webpack-plugin' ) ;
12
+ const ExtractTextPlugin = require ( 'extract-text-webpack-plugin-ignore-order' ) ;
13
+ const originExtractTextPlugin = require ( 'extract-text-webpack-plugin' ) ;
13
14
14
15
const UtilFs = require ( '../utils/fs.js' ) ;
15
16
const UtilPath = require ( '../utils/path.js' ) ;
@@ -219,7 +220,7 @@ class Project {
219
220
: ykitConfigFile . config || { } ;
220
221
221
222
extend ( true , this . config , ykitJSConfig ) ;
222
-
223
+
223
224
handleExportsConfig . bind ( this ) ( ykitJSConfig ) ;
224
225
handleCommonsChunk . bind ( this ) ( this . config ) ;
225
226
@@ -250,11 +251,11 @@ class Project {
250
251
/**
251
252
* 处理config.commonsChunk配置项,基于CommonsChunkPlugin插件封装
252
253
* commonsChunk: {
253
- name: 'common',
254
+ name: 'common',
254
255
minChunks: 2, //公共模块被使用的最小次数。比如配置为3,也就是同一个模块只有被3个以外的页面同时引用时才会被提取出来作为common chunks,默认为2
255
- vendors: {
256
- lib: ['jquery', 'underscore', 'moment'],
257
- charts: ['highcharts', 'echarts']
256
+ vendors: {
257
+ lib: ['jquery', 'underscore', 'moment'],
258
+ charts: ['highcharts', 'echarts']
258
259
}
259
260
}
260
261
* @param {* } config
@@ -286,7 +287,7 @@ class Project {
286
287
}
287
288
288
289
}
289
-
290
+
290
291
291
292
if ( chunks . length > 0 ) {
292
293
let chunkFilename = filenameTpl . filename ;
@@ -302,7 +303,7 @@ class Project {
302
303
}
303
304
}
304
305
}
305
-
306
+
306
307
// 处理 exports.config 中 export 和旧接口
307
308
308
309
function handleExportsConfig ( exportsConfig , options ) {
@@ -386,9 +387,9 @@ class Project {
386
387
}
387
388
}
388
389
389
- // 如果没有 ExtractTextPlugin 则添加进 Plugins
390
+ // 如果没有 ExtractTextPlugin 则为项目添加一个
390
391
const isExtractTextPluginExists = config . plugins . some ( ( plugin ) => {
391
- return plugin instanceof ExtractTextPlugin ;
392
+ return plugin instanceof originExtractTextPlugin ;
392
393
} ) ;
393
394
if ( ! isExtractTextPluginExists ) {
394
395
config . plugins . push ( new ExtractTextPlugin ( config . output . filename . replace ( '[ext]' , '.css' ) ) ) ;
0 commit comments