Skip to content
This repository was archived by the owner on Jun 25, 2020. It is now read-only.

Prevent chunking out when not in production environment #50

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ module.exports.pitch = function(remainingRequest) {
var chunkNameParam = '';
}
var result;
if(query.lazy) {
if(process.env.NODE_ENV !== 'production') {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's better to introduce an option here, NODE_ENV === 'production' is common, but no real standard

result = ["var file = require(", loaderUtils.stringifyRequest(this, "!!" + remainingRequest), "); module.exports = function(cb) { cb(file); }"];
} else if(query.lazy) {
result = [
"module.exports = function(cb) {\n",
" require.ensure([], function(require) {\n",
Expand Down