author | ymh <ymh.work@gmail.com> |
Mon, 17 Sep 2018 18:35:17 +0200 | |
changeset 9 | 3458ef964882 |
parent 6 | 819a7ab4e3fb |
child 11 | 37ecf0b9c174 |
permissions | -rw-r--r-- |
0
5f4fcbc80b37
Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
1 |
const path = require('path'); |
5f4fcbc80b37
Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
2 |
// const nodeExternals = require('webpack-node-externals'); |
5f4fcbc80b37
Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
3 |
const MiniCssExtractPlugin = require('mini-css-extract-plugin'); |
5f4fcbc80b37
Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
4 |
|
5f4fcbc80b37
Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
5 |
module.exports = { |
6
819a7ab4e3fb
aborted async loading test, better split dashboard-components
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
6 |
entry: { |
819a7ab4e3fb
aborted async loading test, better split dashboard-components
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
7 |
pages: path.resolve(__dirname, 'src/pages'), |
819a7ab4e3fb
aborted async loading test, better split dashboard-components
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
8 |
layouts: path.resolve(__dirname, 'src/layouts'), |
819a7ab4e3fb
aborted async loading test, better split dashboard-components
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
9 |
reducers: path.resolve(__dirname, 'src/reducers'), |
819a7ab4e3fb
aborted async loading test, better split dashboard-components
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
10 |
ui: path.resolve(__dirname, 'src/ui'), |
819a7ab4e3fb
aborted async loading test, better split dashboard-components
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
11 |
actions: path.resolve(__dirname, 'src/actions.js'), |
819a7ab4e3fb
aborted async loading test, better split dashboard-components
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
12 |
}, |
819a7ab4e3fb
aborted async loading test, better split dashboard-components
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
13 |
// path.resolve(__dirname, 'src/index.js'), |
0
5f4fcbc80b37
Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
14 |
output: { |
5f4fcbc80b37
Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
15 |
path: path.resolve(__dirname, 'lib'), |
6
819a7ab4e3fb
aborted async loading test, better split dashboard-components
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
16 |
// filename: 'dashboard-components.[name].js', |
819a7ab4e3fb
aborted async loading test, better split dashboard-components
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
17 |
filename: '[name].js', |
819a7ab4e3fb
aborted async loading test, better split dashboard-components
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
18 |
library: ['dashboard-components', '[name]'], |
819a7ab4e3fb
aborted async loading test, better split dashboard-components
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
19 |
libraryTarget: 'umd', |
0
5f4fcbc80b37
Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
20 |
}, |
5f4fcbc80b37
Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
21 |
resolve: { |
5f4fcbc80b37
Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
22 |
extensions: ['.wasm', '.mjs', '.js', '.json', '.jsx'], |
5f4fcbc80b37
Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
23 |
}, |
5f4fcbc80b37
Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
24 |
// externals: [nodeExternals()], |
5f4fcbc80b37
Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
25 |
target: 'web', |
5f4fcbc80b37
Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
26 |
module: { |
5f4fcbc80b37
Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
27 |
rules: [ |
5f4fcbc80b37
Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
28 |
{ |
5f4fcbc80b37
Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
29 |
test: /\.(js|jsx)$/, |
5f4fcbc80b37
Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
30 |
enforce: 'pre', |
5f4fcbc80b37
Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
31 |
exclude: /node_modules/, |
5f4fcbc80b37
Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
32 |
loader: 'eslint-loader', |
5f4fcbc80b37
Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
33 |
options: { |
5f4fcbc80b37
Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
34 |
emitWarning: true, |
5f4fcbc80b37
Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
35 |
failOnWarning: true, |
5f4fcbc80b37
Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
36 |
failOnError: true, |
5f4fcbc80b37
Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
37 |
}, |
5f4fcbc80b37
Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
38 |
}, |
5f4fcbc80b37
Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
39 |
{ |
5f4fcbc80b37
Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
40 |
test: /\.(js|jsx)$/, |
5f4fcbc80b37
Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
41 |
exclude: /node_modules/, |
5f4fcbc80b37
Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
42 |
loader: 'babel-loader', |
5f4fcbc80b37
Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
43 |
options: { |
5f4fcbc80b37
Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
44 |
presets: ['@babel/preset-env', '@babel/preset-react'], |
5f4fcbc80b37
Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
45 |
plugins: ['@babel/plugin-proposal-class-properties'], |
5f4fcbc80b37
Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
46 |
}, |
5f4fcbc80b37
Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
47 |
}, |
5f4fcbc80b37
Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
48 |
{ |
5f4fcbc80b37
Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
49 |
test: /\.s[c|a]ss$/, |
5f4fcbc80b37
Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
50 |
use: ['style-loader', MiniCssExtractPlugin.loader, 'css-loader', 'postcss-loader', 'sass-loader'], |
5f4fcbc80b37
Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
51 |
}, |
5f4fcbc80b37
Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
52 |
{ |
5f4fcbc80b37
Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
53 |
test: /\.(png|jpg|gif)$/i, |
5f4fcbc80b37
Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
54 |
use: [ |
5f4fcbc80b37
Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
55 |
{ |
5f4fcbc80b37
Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
56 |
loader: 'url-loader', |
5f4fcbc80b37
Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
57 |
options: { |
5f4fcbc80b37
Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
58 |
limit: 8192, |
5f4fcbc80b37
Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
59 |
}, |
5f4fcbc80b37
Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
60 |
}, |
5f4fcbc80b37
Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
61 |
], |
5f4fcbc80b37
Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
62 |
}, |
5f4fcbc80b37
Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
63 |
], |
5f4fcbc80b37
Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
64 |
}, |
5f4fcbc80b37
Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
65 |
plugins: [ |
5f4fcbc80b37
Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
66 |
new MiniCssExtractPlugin({ |
6
819a7ab4e3fb
aborted async loading test, better split dashboard-components
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
67 |
// filename: 'dashboard-components.[name].css', |
819a7ab4e3fb
aborted async loading test, better split dashboard-components
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
68 |
filename: '[name].css', |
0
5f4fcbc80b37
Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
69 |
}), |
5f4fcbc80b37
Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
70 |
], |
5f4fcbc80b37
Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
71 |
performance: { |
5f4fcbc80b37
Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
72 |
hints: false, |
5f4fcbc80b37
Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
73 |
}, |
5f4fcbc80b37
Create new repository to host all dashboard developments
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
74 |
}; |