Created
March 22, 2017 02:35
-
-
Save pencilcheck/07367be32f528e52ce0d97b834474b93 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = { | |
webpack: (config) => { | |
config.module.rules.push( | |
// yaml | |
{ | |
test: /\.yaml$/, | |
use: [ | |
{ | |
loader: 'emit-file-loader', | |
options: { | |
name: 'dist/[path][name].[ext]' | |
} | |
}, | |
'json-loader', | |
'yaml-loader' | |
] | |
}, | |
// CSS rule for module css (mostly global) | |
{ | |
test: /\.css$/, | |
include (str) { | |
return /node_modules/.test(str) | |
}, | |
exclude (str) { | |
return !/node_modules/.test(str) | |
}, | |
use: [ | |
{ | |
loader: 'emit-file-loader', | |
options: { | |
name: 'dist/[path][name].[ext]' | |
} | |
}, | |
'raw-loader', | |
'val-loader', | |
{ | |
loader: 'skeleton-loader', | |
options: { | |
procedure: (content) => ( | |
`${content} \n` + ['module.exports = {', | |
'stylesheet: module.exports.toString(),', | |
'classNames: exports.locals', | |
'}' | |
].join('') | |
) | |
} | |
}, | |
{ | |
loader: 'css-loader', | |
options: { | |
modules: true, | |
minimize: true, | |
importLoaders: 1, | |
localIdentName: '[local]' // no local hash name for antd global css names | |
} | |
} | |
] | |
}, | |
// CSS rule for internal scoped css | |
{ | |
test: /\.css$/, | |
include (str) { | |
return !/node_modules/.test(str) | |
}, | |
exclude (str) { | |
return /node_modules/.test(str) | |
}, | |
use: [ | |
{ | |
loader: 'emit-file-loader', | |
options: { | |
name: 'dist/[path][name].[ext]' | |
} | |
}, | |
'raw-loader', | |
'val-loader', | |
{ | |
loader: 'skeleton-loader', | |
options: { | |
procedure: (content) => ( | |
`${content} \n` + ['module.exports = {', | |
'stylesheet: module.exports.toString(),', | |
'classNames: exports.locals', | |
'}' | |
].join('') | |
) | |
} | |
}, | |
{ | |
loader: 'css-loader', | |
options: { | |
modules: true, | |
minimize: true, | |
importLoaders: 1, | |
localIdentName: '[local]-[hash:base64:5]' | |
} | |
} | |
] | |
} | |
) | |
return config | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment