const path = require('path'),
webpack = require('webpack'),
ExtractTextPlugin = require('extract-text-webpack-plugin'),
WriteFilePlugin = require('write-file-webpack-plugin');
var plugins, cssloaders, jsloaders, mainjs, entry;
if (process.env.NODE_ENV === 'development') {
plugins = [
new webpack.HotModuleReplacementPlugin(),
new webpack.optimize.CommonsChunkPlugin({
children: true, // necessary for splitting children chunks
async: true // necessary for async loading chunks
}),
new WriteFilePlugin({})
];
mainjs = [
//'react-hot-loader/patch',
'webpack-hot-middleware/client',
'./src/index.js'
];
entry = {
'main.js': mainjs
};
cssloaders = ['css-loader', 'ruby-sass-loader?outputStyle=compressed&compass=true&cwd=' + path.resolve(__dirname, './'), {
loader: 'sass-resources-loader',
options: {
resources: path.resolve(__dirname, './src/scss/index.scss')
}
}];
jsloaders = ['react-hot-loader/webpack', 'babel-loader'];
} else {
plugins = [
new webpack.NoErrorsPlugin(),
new webpack.optimize.OccurrenceOrderPlugin(),
new webpack.optimize.DedupePlugin(),
new webpack.optimize.ModuleConcatenationPlugin(),
new webpack.optimize.CommonsChunkPlugin({
children: true, // necessary for splitting children chunks
async: true // necessary for async loading chunks
}),
new webpack.DefinePlugin({
'process.env': {
'NODE_ENV': JSON.stringify('production')
}
}),
new ExtractTextPlugin({
filename: 'style.css',
allChunks: true
})
];
mainjs = './src/index.js';
entry = {
'main.js': mainjs,
'style.css': './src/scss/index.scss'
};
cssloaders = ExtractTextPlugin.extract({
use: [{
loader: 'css-loader',
options: {
minimize: true
}
}, {
loader: 'ruby-sass-loader?outputStyle=compressed&compass=true&cwd=' + path.resolve(__dirname, './')
}, {
loader: 'sass-resources-loader',
options: {
resources: path.resolve(__dirname, './src/scss/index.scss')
}
}]
});
jsloaders = ['babel-loader'];
}
module.exports = {
devtool: process.env.NODE_ENV === 'production' ? false : 'cheap-module-eval-source-map',
entry: entry,
resolve: {
alias: {
react: 'preact-compat',
'react-dom': 'preact-compat',
"preact-compat": "preact-compat/dist/preact-compat"
}
},
output: {
path: path.join(__dirname, 'dist'),
filename: '[name]',
publicPath: '/dist/',
hotUpdateChunkFilename: 'hot/hot-update.js',
hotUpdateMainFilename: 'hot/hot-update.json',
chunkFilename: '[id].js'
},
plugins: plugins,
module: {
loaders: [{
test: /\.(scss|sass|css)$/,
loaders: cssloaders
}, {
test: /\.jsx?$/,
loaders: jsloaders,
include: path.join(__dirname, 'src')
},
{
test: /\.woff2?$|\.ttf$|\.eot$|\.svg$|\.png|\.jpe?g|\.gif$/,
loader: 'file-loader'
}]
}
};
Но там не менее. Переписывать на Go опять же таки то, что работает, а тем более в целом на незнакомый мне язык. Ну вряд ли разумное решение.
Node.js хорошо работает параллельно, не считая socket.io.
Да и в целом, вон там завезли SharedArrayBuffer и Atomics.