yoda-common-boilerplate
Version:
Repository of all JCP reusable atoms, molecules and organisms
75 lines (71 loc) • 2.41 kB
JavaScript
/**
* This web.config specific to application. TODO: This need refactoring to be moved to config folder and prod build
*/
var path = require('path');
var webpack = require('webpack');
var styleLintPlugin = require('stylelint-webpack-plugin');
var isProd = process.env.NODE_ENV === 'production';
let config = {
resolve: {
root: [
path.resolve('.') + '/src'
],
alias: {
molecules: path.resolve('.') + '/src/molecules',
atoms: path.resolve('.') + '/src/atoms',
organisms: path.resolve('.') + '/src/organisms',
styles: path.resolve('.') + '/src/styles',
mocks: path.resolve('.') + '/src/mocks',
pages: path.resolve('.') + '/src/pages'
},
extensions: ['', '.js', '.jsx']
},
devtool: 'cheap-module-eval-source-map',
entry: [
path.resolve(__dirname, './src/atoms/index.jsx'),
path.resolve(__dirname, './src/molecules/index.jsx')
],
output: {
path: path.join(__dirname, 'build'),
filename: 'bundle.js',
chunkFileName: "shared.js",
publicPath: '/static/'
},
plugins: [
new styleLintPlugin({
configFile: '.stylelintrc',
context: path.resolve(__dirname, './src'),
files: '**/*.css',
failOnError: false,
}),
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.HotModuleReplacementPlugin()
],
module: {
loaders: [
{
test: /\.jsx?$/,
exclude: /node_modules/,
loaders: ['babel'],
presets: ['es2015', 'react', "stage-0"]
},
{
test: /\.css?$/,
loaders: [
'style-loader',
'css-loader?modules&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]',
'postcss-loader'
],
include: __dirname
}
]
},
postcss: function () {
return [require('postcss-smart-import')({path: ['./src/styles']}), require('postcss-cssnext'),
require('postcss-for'), require('postcss-nesting')()];
}
};
if (!isProd) { //TODO:PR: Externalize this in seperate conf file for clarity
config.entry.push('webpack-hot-middleware/client');
}
module.exports = config;