-
Notifications
You must be signed in to change notification settings - Fork 2
/
nwb.config.js
63 lines (60 loc) · 1.55 KB
/
nwb.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
'use strict'
module.exports = {
// Let nwb know this is a React app when generic build commands are used
type: 'react-app',
loaders: {
'stylus-css': {
query: {
modules: true,
localIdentName: '[name]の[local]/[hash:base64:7]',
importLoaders: 2
}
},
extra: [
{
test: /\.yml$/,
loaders: [ 'json-loader', 'yaml-loader' ]
}
]
},
karma: {
tests: 'tests/index.js',
reporters: [ 'mocha', 'growl' ],
plugins: [
require('karma-growl-reporter')
]
},
babel: {
plugins: [ require.resolve('babel-plugin-espower') ]
}
}
// ヤバい!!!!
const ride = require('ride')
const u = require('updeep').default
ride(require('nwb/lib/createWebpackConfig'), 'default', original => {
return function () {
const result = original.apply(this, arguments)
if (!result.module.noParse) result.module.noParse = [ ]
result.module.noParse.push(/standard-format/)
if (result.output) {
result.output.chunkFilename = '[name]-[chunkhash].js'
}
for (const plugin of Array.from(result.plugins)) {
if (plugin.constructor.name.match(/ExtractText/)) {
console.error('Hack: Extracting CSS from all chunks!')
plugin.options.allChunks = true
}
}
// const removeExtract = u.if(
// spec => spec.loader, {
// loader: l => l.replace(/^.*?extract-text[^!]*!/, 'style!')
// }
// )
// return u({
// module: {
// loaders: u.map(removeExtract)
// }
// })(result)
return result
}
})