forked from ImagingDataCommons/slim
-
Notifications
You must be signed in to change notification settings - Fork 0
/
craco.config.js
77 lines (76 loc) · 2.28 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
const CracoLessPlugin = require('craco-less')
const CopyWebpackPlugin = require('copy-webpack-plugin')
module.exports = {
plugins: [
{
plugin: CracoLessPlugin,
options: {
lessLoaderOptions: {
lessOptions: {
modifyVars: {
'@layout-header-background': '#007ea3',
'@primary-color': '#007ea3',
'@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)/)'
]
return config
}
}
}