yahoi
Version:
Yet Another Highly Opinionated Isomorphic Framework
86 lines (82 loc) • 2.24 kB
JavaScript
const ProgressBarPlugin = require('progress-bar-webpack-plugin');
const webpack = require('webpack');
const path = require('path');
module.exports = function(props) {
let projectPath = props.projectPath;
return {
entry: ['./src/Client/index.js', 'webpack-hot-middleware/client'],
devtool: 'eval',
output: {
path: path.resolve(projectPath, 'dist', 'public', 'clientjs'),
filename: '[name].js',
publicPath: "/public/clientjs/",
},
plugins: [
new ProgressBarPlugin(),
new webpack.HotModuleReplacementPlugin(),
new webpack.optimize.CommonsChunkPlugin({
minChunks: ({ resource }) => /node_modules/.test(resource),
name: "vendor"
}),
new webpack.DefinePlugin({
'__environment': { cool: "haha" }
}),
new webpack.ProvidePlugin({
trans: [path.resolve(__dirname, '..', 'dist', 'lib', 'client-translator'), 'default'],
}),
new webpack.IgnorePlugin(/require-all/),
],
resolve: {
alias: {
Components: './src/Components',
Containers: './src/Containers',
Actions: './src/Actions',
Environment: './src/Environments/development'
}
},
module: {
rules: [
{
exclude: /(node_modules|bower_components)/,
test: /\.jsx?$/,
use: [{
loader: 'babel-loader',
}]
},
{
test: /\.css$/,
use: [
"style-loader",
{
loader: "css-loader",
options: {
modules: true,
sourceMap: true,
importLoaders: 1,
localIdentName: "[name]--[local]--[hash:base64:5]"
}
},
{
loader: "postcss-loader",
options: {
config: {
path: __dirname+'/postcss.config.js'
}
}
}
]
},
{
test: /\.scss$/,
use: [{
loader: "style-loader"
}, {
loader: "css-loader",
}, {
loader: "sass-loader"
}]
}
]
}
}
}