Created
March 2, 2016 06:38
-
-
Save dtinth/37f30898da983388d6c3 to your computer and use it in GitHub Desktop.
wonderstudio nwb config
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
'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) | |
// Need this due to some module is a huge browserified lib. | |
if (!result.module.noParse) result.module.noParse = [ ] | |
result.module.noParse.push(/standard-format/) | |
// For long term caching. | |
if (result.output) { | |
result.output.chunkFilename = '[name]-[chunkhash].js' | |
} | |
// Fix problem where CSS from code-splitted chunks are not included in generated CSS file, breaking the build on production. | |
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 | |
} | |
} | |
return result | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment