forked from sourcegraph/sourcegraph-public-snapshot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.ts
39 lines (35 loc) · 1.16 KB
/
webpack.config.ts
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
import * as path from 'path'
import * as webpack from 'webpack'
export default ({ config }: { config: webpack.Configuration }) => {
if (!config.module || !config.resolve?.extensions) {
throw new Error('unexpected config')
}
config.module.rules.push({
test: /\.tsx?$/,
loader: require.resolve('babel-loader'),
options: {
configFile: path.resolve(__dirname, '..', 'babel.config.js'),
},
})
config.resolve.extensions.push('.ts', '.tsx')
// Put our style rules at the beginning so they're processed by the time it
// gets to storybook's style rules.
config.module.rules.unshift({
test: /\.(css|sass|scss)$/,
use: [
'style-loader',
'css-loader',
{
loader: 'sass-loader',
options: {
sassOptions: {
includePaths: [path.resolve(__dirname, '..', 'node_modules')],
},
},
},
],
// Make sure Storybook styles get handled by the Storybook config
exclude: /node_modules\/@storybook\//,
})
return config
}