2016-10-24 12:57:21 +03:00
|
|
|
const ExtractTextPlugin = require('extract-text-webpack-plugin');
|
2016-10-20 04:14:26 +03:00
|
|
|
const pkg = require('../package.json');
|
|
|
|
const webpack = require('webpack');
|
2016-10-20 22:42:39 +03:00
|
|
|
const WebpackShellPlugin = require('webpack-shell-plugin');
|
2016-10-20 04:14:26 +03:00
|
|
|
const path = require('path');
|
|
|
|
|
2016-10-24 14:23:05 +03:00
|
|
|
const plugins = {
|
|
|
|
'no-errors-plugin': new webpack.NoErrorsPlugin(),
|
|
|
|
'extract-text-plugin': new ExtractTextPlugin({
|
|
|
|
filename: 'bundle.css',
|
|
|
|
allChunks: true
|
|
|
|
}),
|
|
|
|
'loader-options-plugin': new webpack.LoaderOptionsPlugin({
|
|
|
|
options: {
|
|
|
|
postcss: {
|
|
|
|
plugins: () => {
|
|
|
|
return [
|
|
|
|
require('postcss-cssnext')
|
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}),
|
|
|
|
'define-plugin': new webpack.DefinePlugin({
|
|
|
|
'process.env': {
|
|
|
|
NODE_ENV: JSON.stringify(process.env['NODE_ENV'] || 'development'),
|
|
|
|
APP_NAME: JSON.stringify(pkg.name),
|
|
|
|
APP_VERSION: JSON.stringify(pkg.version)
|
|
|
|
}
|
|
|
|
}),
|
|
|
|
'shell-plugin': new WebpackShellPlugin({
|
|
|
|
onBuildStart: ['npm run build-locales']
|
|
|
|
})
|
|
|
|
};
|
|
|
|
|
2016-10-24 16:11:50 +03:00
|
|
|
exports.config = {
|
2016-10-20 04:14:26 +03:00
|
|
|
context: path.join(__dirname, '../src'),
|
|
|
|
output: {
|
|
|
|
path: path.join(__dirname, '../static'),
|
|
|
|
publicPath: '/static/',
|
|
|
|
filename: 'bundle.js'
|
|
|
|
},
|
|
|
|
plugins: [
|
2016-10-24 14:23:05 +03:00
|
|
|
plugins['no-errors-plugin'],
|
|
|
|
plugins['extract-text-plugin'],
|
|
|
|
plugins['loader-options-plugin'],
|
|
|
|
plugins['define-plugin'],
|
|
|
|
plugins['shell-plugin']
|
2016-10-20 04:14:26 +03:00
|
|
|
],
|
|
|
|
module: {
|
|
|
|
loaders: [{
|
|
|
|
test: /js?$/,
|
|
|
|
exclude: /node_modules/,
|
|
|
|
include: [
|
|
|
|
path.join(__dirname, '../src')
|
|
|
|
],
|
|
|
|
loaders: ['babel']
|
|
|
|
}, {
|
|
|
|
test: /\.json?$/,
|
|
|
|
exclude: /node_modules/,
|
|
|
|
include: [
|
|
|
|
path.join(__dirname, '../src')
|
|
|
|
],
|
|
|
|
loaders: ['json']
|
2016-10-20 19:47:29 +03:00
|
|
|
}, {
|
2016-10-24 12:57:21 +03:00
|
|
|
test: /\.css?$/,
|
|
|
|
exclude: /node_modules/,
|
|
|
|
include: [
|
|
|
|
path.join(__dirname, '../src')
|
|
|
|
],
|
|
|
|
loader: ExtractTextPlugin.extract({
|
|
|
|
fallbackLoader: 'style-loader',
|
|
|
|
loader: 'css-loader?modules&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]!postcss-loader'
|
|
|
|
})
|
|
|
|
}]
|
2016-10-20 04:14:26 +03:00
|
|
|
}
|
|
|
|
};
|
2016-10-24 14:23:05 +03:00
|
|
|
|
2016-10-24 16:11:50 +03:00
|
|
|
exports.plugins = plugins;
|