UNPKG

2.28 kBJavaScriptView Raw
1const ProgressBarPlugin = require('progress-bar-webpack-plugin');
2const webpack = require('webpack');
3const path = require('path');
4
5module.exports = function(props) {
6
7 let projectPath = props.projectPath;
8
9 return {
10 entry: ['./src/Client/index.js', 'webpack-hot-middleware/client'],
11 stats: {
12 verbose: true
13 },
14 devtool: 'eval',
15 output: {
16 path: path.resolve(projectPath, 'dist', 'public', 'clientjs'),
17 filename: '[name].js',
18 publicPath: "/public/clientjs/",
19 },
20 plugins: [
21 new ProgressBarPlugin(),
22 new webpack.HotModuleReplacementPlugin(),
23 new webpack.optimize.CommonsChunkPlugin({
24 minChunks: ({ resource }) => /node_modules/.test(resource),
25 name: "vendor"
26 }),
27 new webpack.DefinePlugin({
28 '__environment': { cool: "haha" }
29 }),
30 new webpack.ProvidePlugin({
31 trans: [path.resolve(__dirname, '..', 'dist', 'lib', 'client-translator'), 'default'],
32 }),
33 new webpack.IgnorePlugin(/require-all/),
34 ],
35 resolve: {
36 alias: {
37 Components: './src/Components',
38 Containers: './src/Containers',
39 Actions: './src/Actions',
40 Environment: './src/Environments/development'
41 }
42 },
43 module: {
44 rules: [
45 {
46 exclude: /(node_modules|bower_components)/,
47 test: /\.jsx?$/,
48 use: [{
49 loader: 'babel-loader',
50 }]
51 },
52 {
53 test: /\.css$/,
54 use: [
55 "style-loader",
56 {
57 loader: "css-loader",
58 options: {
59 modules: true,
60 sourceMap: true,
61 importLoaders: 1,
62 localIdentName: "[name]--[local]--[hash:base64:5]"
63 }
64 },
65 {
66 loader: "postcss-loader",
67 options: {
68 config: {
69 path: __dirname+'/postcss.config.js'
70 }
71 }
72 }
73 ]
74 },
75 {
76 test: /\.scss$/,
77 use: [{
78 loader: "style-loader"
79 }, {
80 loader: "css-loader",
81 }, {
82 loader: "sass-loader"
83 }]
84 }
85 ]
86 }
87 }
88
89}
\No newline at end of file