1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-13 01:36:22 +00:00

bumpup react (0.13.3->0.14.0), reacthmr work perfectly

This commit is contained in:
Rokt33r
2015-10-21 02:47:21 +09:00
parent 326c7a93fb
commit f6d2e898dc
12 changed files with 109 additions and 78 deletions

View File

@@ -1,21 +1,22 @@
var webpack = require('webpack')
module.exports = {
entry: {
main: './browser/main/index.js'
},
output: {
filename: '[name].js',
sourceMapFilename: '[name].map',
publicPath: 'http://localhost:8090/assets',
libraryTarget: 'commonjs2'
},
devtool: '#inline-source-map',
var path = require('path')
var JsonpTemplatePlugin = webpack.JsonpTemplatePlugin
var FunctionModulePlugin = require('webpack/lib/FunctionModulePlugin')
var NodeTargetPlugin = require('webpack/lib/node/NodeTargetPlugin')
var ExternalsPlugin = webpack.ExternalsPlugin
var opt = {
path: path.join(__dirname, 'compiled'),
filename: 'bundle.js',
libraryTarget: 'commonjs2',
publicPath: 'http://localhost:8080/assets/'
}
var config = {
module: {
loaders: [
{
test: /(\.js|\.jsx)?$/,
exclude: /(node_modules|bower_components)/,
loader: 'babel'
test: /\.js?$/,
loader: 'babel-loader?cacheDirectory',
exclude: /node_modules/
},
{
test: /\.styl?$/,
@@ -24,29 +25,57 @@ module.exports = {
}
]
},
debug: true,
devtool: 'cheap-module-eval-source-map',
entry: [
'./browser/main/index.js'
],
output: opt,
resolve: {
extensions: ['', '.js', '.jsx'],
packageMains: ['webpack', 'browser', 'web', 'browserify', ['jam', 'main'], 'main']
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
new webpack.NoErrorsPlugin()
new webpack.NoErrorsPlugin(),
new ExternalsPlugin('commonjs', [
'app',
'auto-updater',
'browser-window',
'content-tracing',
'dialog',
'global-shortcut',
'ipc',
'menu',
'menu-item',
'power-monitor',
'protocol',
'tray',
'remote',
'web-frame',
'clipboard',
'crash-reporter',
'screen',
'shell'
]),
new NodeTargetPlugin()
],
externals: [
'socket.io-client',
'md5',
'superagent',
'superagent-promise',
'react',
'redux',
'react-redux',
'react-router',
'lodash',
'redbox-react',
'react-transform-hmr',
'react-transform-catch-errors',
'react-select',
'markdown-it',
'moment'
],
resolve: {
extensions: ['', '.js', '.jsx', 'styl']
},
target: 'atom'
]
}
config.target = function renderer (compiler) {
compiler.apply(
new JsonpTemplatePlugin(opt),
new FunctionModulePlugin(opt)
)
}
module.exports = config