spec: fix crystalball map js build

why:
- Our build is currently broken due to some config additions I made to
  enable HMR.
- We'll only enable the react refresh config in dev when we're not
  trying to build coverage.

flag=none

test-plan:
- You can run `CRYSTALBALL_MAP=1 yarn build:js` locally without error.
- The failing build passes.

Change-Id: I89a79d576632a4169239f2ef6115d9bc0c2a5795
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/352625
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: James Butters <jbutters@instructure.com>
QA-Review: Ryan Hawkins <ryan.hawkins@instructure.com>
Product-Review: Ryan Hawkins <ryan.hawkins@instructure.com>
This commit is contained in:
Ryan Hawkins 2024-07-15 10:41:09 -06:00
parent 6380ed41f5
commit 3b76410eea
1 changed files with 13 additions and 6 deletions

View File

@ -139,12 +139,19 @@ exports.swc = [
env: {
targets: browserTargets,
},
transform: {
react: {
development: process.env.NODE_ENV === 'development',
refresh: process.env.NODE_ENV === 'development',
},
},
// Our coverage plugin gets really upset about the transform field, even
// if it's just react: {development: false, refresh: false}, so we only
// include it in development mode when crystalball is disabled.
...(process.env.NODE_ENV === 'development' && !isCrystalballEnabled
? {
transform: {
react: {
development: process.env.NODE_ENV === 'development',
refresh: process.env.NODE_ENV === 'development',
},
},
}
: {}),
},
},
},