Updated code to not bundle mock data provider when the web part is packaged for distribution.

This commit is contained in:
Chakkaradeep Chandran 2016-10-27 22:39:10 -07:00
parent 72e464cfe2
commit 31a562809d
1 changed files with 3 additions and 2 deletions

View File

@ -32,9 +32,10 @@ export default class TodoWebPart extends BaseClientSideWebPart<ITodoWebPartProps
super(context);
/*
Create the appropriate data provider dependeing on where the web part is running
Create the appropriate data provider dependeing on where the web part is running.
The DEBUG flag will ensure the mock data provider is not bundled with the web part when you package the solution for distribution, that is, using the --ship flag with the package-solution gulp command.
*/
if (context.environment.type === EnvironmentType.Local) {
if (DEBUG && context.environment.type === EnvironmentType.Local) {
this._dataProvider = new MockDataProvider();
} else {
this._dataProvider = new SharePointDataProvider();