Skip to content

Commit

Permalink
fix: 当packing.commonChunks为空时,不应该输出manifest.js
Browse files Browse the repository at this point in the history
  • Loading branch information
zhongzhi107 committed Jan 29, 2018
1 parent 1fd5a42 commit 6c20f4c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/config/webpack.build.babel.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ const webpackConfig = () => {
// 从配置文件中获取并生成webpack打包配置
// fix: #14
let chunkNames = [];
if (commonChunks) {
if (commonChunks && Object.keys(commonChunks).length > 0) {
const manifestChunkName = 'manifest';
chunkNames = Object.keys(commonChunks);
const lastChunkName = chunkNames[chunkNames.length - 1];
Expand Down
6 changes: 3 additions & 3 deletions src/config/webpack.serve.babel.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import OpenBrowserPlugin from 'open-browser-webpack-plugin';
import ProfilesPlugin from 'packing-profile-webpack-plugin';
import pRequire from '../util/require';

const packing = pRequire('config/packing');
const { cdnRoot } = pRequire(`src/profiles/${process.env.NODE_ENV}`);
const {
assetExtensions,
Expand All @@ -21,6 +20,7 @@ const {
hot,
cssModules,
cssModulesIdentName = '[path][name]__[local]--[hash:base64:5]',
commonChunks,
path: {
src,
assets,
Expand Down Expand Up @@ -155,8 +155,8 @@ const webpackConfig = (program) => {
}));

// 从配置文件中获取dll
if (packing.commonChunks) {
Object.keys(packing.commonChunks).forEach((key) => {
if (commonChunks && Object.keys(commonChunks).length > 0) {
Object.keys(commonChunks).forEach((key) => {
plugins.push(new webpack.DllReferencePlugin({
context,
// eslint-disable-next-line
Expand Down

0 comments on commit 6c20f4c

Please sign in to comment.