forked from ImagingDataCommons/slim
-
Notifications
You must be signed in to change notification settings - Fork 0
/
craco.config.js
85 lines (84 loc) · 3.02 KB
/
craco.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
const CracoLessPlugin = require('craco-less')
const CopyWebpackPlugin = require('copy-webpack-plugin')
module.exports = {
plugins: [
{
plugin: CracoLessPlugin,
options: {
lessLoaderOptions: {
lessOptions: {
modifyVars: {
'@layout-header-background': '#3C2C59',
'@primary-color': '#3C2C59',
'@processing-color': '#8cb8c6',
'@success-color': '#3f9c35',
'@warning-color': '#eeaf30',
'@error-color': '#96172e',
'@font-size-base': '14px'
},
javascriptEnabled: true
}
}
}
}
],
webpack: {
configure: (config, { env, paths }) => {
config.resolve = {
fallback: {
fs: false,
path: false
},
extensions: ['.tsx', '.ts', '.js', '.wasm', '.json'],
/* We use this alias and the CopyPlugin below to support using the
* dynamic-import version of Dicom Microscopy Viewer, but only when
* building a PWA. When we build a package, we must use the bundled
* version of Dicom Microscopy Viewer so we can produce a single file
* for the viewer.
*/
alias: {
'dicom-microscopy-viewer':
'dicom-microscopy-viewer/dist/dynamic-import/dicomMicroscopyViewer.min.js'
}
}
config.plugins.push(
// TO DO: remove hard coded path
new CopyWebpackPlugin({
patterns: [
{
from: './node_modules/dicom-microscopy-viewer/dist/dynamic-import',
to: './static/js'
}
]
})
)
config.target = 'web'
config.experiments = {
asyncWebAssembly: true
}
return config
}
},
jest: {
configure: (config, { env, paths }) => {
config.transform = {
'^.+wasm.*\\.js$': '<rootDir>/src/__mocks__/emscriptenMock.js',
'\\.(wasm)$': '<rootDir>/src/__mocks__/wasmMock.js',
'\\.(css|less|sass|scss)$': '<rootDir>/src/__mocks__/styleMock.js',
'^.+\\.[t|j]sx?$': 'babel-jest'
}
config.transformIgnorePatterns = [
'node_modules/(?!(ol|dicom-microscopy-viewer|dicomweb-client|@cornerstonejs|dicomicc)/)'
]
config.moduleNameMapper = {
'@cornerstonejs/codec-libjpeg-turbo-8bit/decodewasmjs': '@cornerstonejs/codec-libjpeg-turbo-8bit/dist/libjpegturbowasm_decode',
'@cornerstonejs/codec-libjpeg-turbo-8bit/decodewasm': '@cornerstonejs/codec-libjpeg-turbo-8bit/dist/libjpegturbowasm_decode.wasm',
'@cornerstonejs/codec-charls/decodewasmjs': '@cornerstonejs/codec-charls/dist/charlswasm_decode.js',
'@cornerstonejs/codec-charls/decodewasm': '@cornerstonejs/codec-charls/dist/charlswasm_decode.wasm',
'@cornerstonejs/codec-openjpeg/decodewasmjs': '@cornerstonejs/codec-openjpeg/dist/openjpegwasm_decode.js',
'@cornerstonejs/codec-openjpeg/decodewasm': '@cornerstonejs/codec-openjpeg/dist/openjpegwasm_decode.wasm'
}
return config
}
}
}