Skip to content

Commit

Permalink
move crystalball webpack config into ui-build
Browse files Browse the repository at this point in the history
flag=none

test-plan:
- crystalball map still generates with istanbul

Change-Id: Ie1be76ba9f1ecbe55af8a3c3a499b6b34f6f5f01
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/282683
Reviewed-by: Manoel Quirino <[email protected]>
Tested-by: Service Cloud Jenkins <[email protected]>
QA-Review: Brian Watson <[email protected]>
Product-Review: Brian Watson <[email protected]>
  • Loading branch information
brianlwatson committed Jan 12, 2022
1 parent 1201c9a commit f267dd4
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 33 deletions.
27 changes: 27 additions & 0 deletions ui-build/webpack/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -396,3 +396,30 @@ module.exports = {
]
)
}

// since istanbul-instrumenter-loader adds so much overhead, only use it when generating crystalball map
if (process.env.CRYSTALBALL_MAP === '1') {
module.exports.module.rules.unshift({
test: /\.(js|ts|tsx)$/,
include: [
path.resolve(canvasDir, 'ui'),
path.resolve(canvasDir, 'packages/jquery-kyle-menu'),
path.resolve(canvasDir, 'packages/jquery-sticky'),
path.resolve(canvasDir, 'packages/jquery-popover'),
path.resolve(canvasDir, 'packages/jquery-selectmenu'),
path.resolve(canvasDir, 'packages/mathml'),
path.resolve(canvasDir, 'packages/persistent-array'),
path.resolve(canvasDir, 'packages/slickgrid'),
path.resolve(canvasDir, 'packages/with-breakpoints'),
path.resolve(canvasDir, 'spec/javascripts/jsx'),
path.resolve(canvasDir, 'spec/coffeescripts'),
/gems\/plugins\/.*\/app\/(jsx|coffeescripts)\//
],
exclude: [/test\//, /spec/],
use: {
loader: 'istanbul-instrumenter-loader',
options: {esModules: true, produceSourceMap: true}
},
enforce: 'post'
})
}
34 changes: 1 addition & 33 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,36 +16,4 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/

const webpack = require('./ui-build/webpack')

// since istanbul-instrumenter-loader adds so much overhead, only use it when generating crystalball map
if (process.env.CRYSTALBALL_MAP === '1') {
const path = require('path')
const {canvasDir} = require('./ui-build/params')

webpack.module.rules.unshift({
test: /\.(js|ts|tsx)$/,
include: [
path.resolve(canvasDir, 'ui'),
path.resolve(canvasDir, 'packages/jquery-kyle-menu'),
path.resolve(canvasDir, 'packages/jquery-sticky'),
path.resolve(canvasDir, 'packages/jquery-popover'),
path.resolve(canvasDir, 'packages/jquery-selectmenu'),
path.resolve(canvasDir, 'packages/mathml'),
path.resolve(canvasDir, 'packages/persistent-array'),
path.resolve(canvasDir, 'packages/slickgrid'),
path.resolve(canvasDir, 'packages/with-breakpoints'),
path.resolve(canvasDir, 'spec/javascripts/jsx'),
path.resolve(canvasDir, 'spec/coffeescripts'),
/gems\/plugins\/.*\/app\/(jsx|coffeescripts)\//
],
exclude: [/test\//, /spec/],
use: {
loader: 'istanbul-instrumenter-loader',
options: {esModules: true, produceSourceMap: true}
},
enforce: 'post'
})
}

module.exports = webpack
module.exports = require('./ui-build/webpack')

0 comments on commit f267dd4

Please sign in to comment.