@@ -17,6 +17,7 @@ module.exports = (options) ->
1717 SITE = if isTC then ' TC' else ' CONNECT'
1818 ENV = process .env .ENV || if isTC then ' DEV' else ' MOCK'
1919 port = 8080
20+ useMockData = false
2021
2122 process .argv .forEach (arg) ->
2223 TEST = true if arg == ' --test'
@@ -25,6 +26,7 @@ module.exports = (options) ->
2526 ENV = ' DEV' if arg == ' --dev'
2627 ENV = ' QA' if arg == ' --qa'
2728 ENV = ' PROD' if arg == ' --prod'
29+ useMockData = true if arg == ' --mock'
2830
2931 if SITE == ' CONNECT'
3032 envConstants = connectConstants (ENV)
@@ -153,13 +155,15 @@ module.exports = (options) ->
153155 path .join dirname, ' /node_modules/appirio-styles/styles'
154156 ]
155157
156-
157158 # Reference: http://webpack.github.io/docs/configuration.html#plugins
158159 # List: http://webpack.github.io/docs/list-of-plugins.html
159160 config .plugins = []
160161
161162 config .plugins .push new ExtractTextPlugin ' [name].[hash].css'
162163
164+ config .plugins .push new webpack.DefinePlugin
165+ __MOCK__ : JSON .stringify (JSON .parse (useMockData || ' false' ))
166+
163167 if ! TEST
164168 config .plugins .push new HtmlWebpackPlugin
165169 template : template || ' ./example/index.html'
@@ -168,6 +172,9 @@ module.exports = (options) ->
168172 NEW_RELIC_APPLICATION_ID : process .env .NEW_RELIC_APPLICATION_ID
169173
170174 if BUILD
175+ # Do not include any .mock.js files if this is a build
176+ config .plugins .push new webpack.IgnorePlugin / \. mock\. js/
177+
171178 # Reference: http://webpack.github.io/docs/list-of-plugins.html#noerrorsplugin
172179 # Only emit files when there are no errors
173180 config .plugins .push new webpack.NoErrorsPlugin ()
0 commit comments