Skip to content

Commit

Permalink
handle zero modules in chunks
Browse files Browse the repository at this point in the history
  • Loading branch information
roachjc committed Oct 16, 2017
1 parent 370bd68 commit 1cff497
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
13 changes: 8 additions & 5 deletions plugin/npm-module/utils/parser.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
module.exports = (stats, target) => {
console.log(stats.chunks);
stats.assets = stats.assets.filter(asset => asset.name !== target);

return {
Expand All @@ -18,11 +19,13 @@ module.exports = (stats, target) => {
chunks: stats.chunks.map(chunk => ({
size: chunk.size,
files: chunk.files,
modules: chunk.modules.map(module => ({
name: module.name,
size: module.size,
id: module.id,
})),
modules: chunk.modules ?
chunk.modules.map(module => ({
name: module.name,
size: module.size,
id: module.id,
}))
: [],
})),

};
Expand Down
4 changes: 0 additions & 4 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ module.exports = (env) => {
const common = merge([
{
entry: {
// vendor: ['react', 'react-dom'],
app: PATHS.app,
},

Expand Down Expand Up @@ -55,12 +54,9 @@ module.exports = (env) => {
],
},
},
// utils.extractCSS(),
utils.purifyCSS({
paths: glob.sync(`${PATHS.app}/**/*.js`, { nodir: true }),
}),
// utils.extractVendorCode(),
// utils.uglifyJS(),
]);

const development = {
Expand Down

0 comments on commit 1cff497

Please sign in to comment.