forked from AdrianBZG/InterMine-Data-Browser-Tool
-
Notifications
You must be signed in to change notification settings - Fork 33
/
craco.config.js
60 lines (56 loc) · 1.38 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
const { when, whenDev, whenProd } = require('@craco/craco')
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer')
const StyleLintPlugin = require('stylelint-webpack-plugin')
const { NormalModuleReplacementPlugin } = require('webpack')
const { extractIcons } = require('./bin/generateIconPack')
const path = require('path')
const emotionPresetOptions = {}
const emotionBabelPreset = require('@emotion/babel-preset-css-prop').default(
undefined,
emotionPresetOptions
)
module.exports = {
babel: {
plugins: [
...emotionBabelPreset.plugins,
[
'import',
{
libraryName: 'react-use',
libraryDirectory: 'lib',
camel2DashComponentName: false,
},
],
],
},
typescript: {
enableTypeChecking: false,
},
webpack: {
plugins: [
...whenProd(() => {
// ICON hack for blueprintjs
extractIcons()
return [
new NormalModuleReplacementPlugin(
/.*\/generated\/iconSvgPaths.*/,
path.join(__dirname, 'node_modules', '@blueprintjs', 'ICON_HACK.js')
),
]
}, []),
...when(Boolean(process.env.ANALYZE), () => [new BundleAnalyzerPlugin()], []),
...whenDev(
() => [
new StyleLintPlugin({
configBasedir: __dirname,
context: path.resolve(__dirname, 'src'),
files: ['**/*.jsx'],
// allow errors to still compile during development
emitWarning: true,
}),
],
[]
),
],
},
}