joyent-portal/frontend/webpack/config.js
2016-10-24 11:02:18 +01:00

70 lines
1.7 KiB
JavaScript

const ExtractTextPlugin = require('extract-text-webpack-plugin');
const pkg = require('../package.json');
const webpack = require('webpack');
const WebpackShellPlugin = require('webpack-shell-plugin');
const path = require('path');
module.exports = {
context: path.join(__dirname, '../src'),
output: {
path: path.join(__dirname, '../static'),
publicPath: '/static/',
filename: 'bundle.js'
},
plugins: [
new webpack.NoErrorsPlugin(),
new ExtractTextPlugin({
filename: 'bundle.css',
allChunks: true
}),
new webpack.LoaderOptionsPlugin({
options: {
postcss: {
plugins: () => {
return [
require('postcss-cssnext')
];
}
}
}
}),
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)
}
}),
new WebpackShellPlugin({
onBuildStart: ['npm run build-locales']
})
],
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']
}, {
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'
})
}]
}
};