-
Notifications
You must be signed in to change notification settings - Fork 411
/
webpack.config.js
32 lines (26 loc) · 1.04 KB
/
webpack.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
const sanityServer = require('@sanity/server')
module.exports = (storyWpConfig, configType) => {
/* eslint-disable strict */
'use strict'
const sanityWpConfig = sanityServer.getWebpackBaseConfig({
basePath: __dirname,
commonChunkPlugin: false
})
sanityWpConfig.module = sanityWpConfig.module || {loaders: []}
if (configType.toLowerCase() === 'development') {
sanityWpConfig.module.loaders = sanityServer.applyStaticLoaderFix(sanityWpConfig, {
httpHost: 'localhost',
httpPort: 9001,
staticPath: './static'
})
}
return Object.assign({}, sanityWpConfig, storyWpConfig, {
plugins: [].concat(storyWpConfig.plugins, sanityWpConfig.plugins || []),
resolve: Object.assign({}, storyWpConfig.resolve, sanityWpConfig.resolve, {
alias: Object.assign({}, storyWpConfig.resolve.alias || {}, sanityWpConfig.resolve.alias || {})
}),
module: Object.assign({}, storyWpConfig.module, sanityWpConfig.module, {
loaders: [].concat(storyWpConfig.module.loaders, sanityWpConfig.module.loaders)
})
})
}